-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(AccountView): Save account changes
- Added new view for managing user account settings - Added form fields for updating first name, last name, username, and email - Implemented saveAccount method to update the user account in the database - Displayed current user data in the form fields for easy editing
- Loading branch information
1 parent
6fe2d22
commit bed963a
Showing
11 changed files
with
140 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { BrowserTracing, Replay, init, vueRouterInstrumentation } from "@sentry/vue"; | ||
import DefaultToast from "@/components/Toasts/DefaultToast.vue"; | ||
|
||
import type { Options, TracingOptions } from "@sentry/vue/types/types"; | ||
import type { App } from "vue"; | ||
|
||
type SentryOptions = Partial< | ||
Omit<Options, "tracingOptions"> & { | ||
tracingOptions: Partial<TracingOptions>; | ||
} | ||
>; | ||
|
||
const vuePluginSentry = { | ||
install: (app: App, options?: SentryOptions) => { | ||
init({ | ||
dsn: "https://d1994be8f88578e14f1a4ac06ae65e89@o4505748808400896.ingest.sentry.io/4505780347666432", | ||
integrations: [ | ||
new BrowserTracing({ | ||
tracePropagationTargets: [location.origin], | ||
routingInstrumentation: vueRouterInstrumentation(app.config.globalProperties.$router), | ||
}), | ||
new Replay({ | ||
maskAllText: false, | ||
blockAllMedia: false, | ||
maskAllInputs: false, | ||
}), | ||
], | ||
environment: process.env.NODE_ENV, | ||
tracesSampleRate: 1.0, | ||
replaysSessionSampleRate: 1.0, | ||
replaysOnErrorSampleRate: 1.0, | ||
beforeSend(event, hint) { | ||
if (event.exception) { | ||
const errorMessage = event.message ?? "Unknown error"; | ||
app.config.globalProperties.$toast.error(DefaultToast("Detected Error", `${errorMessage}, this can generally be ignored.`)); | ||
} | ||
return event; | ||
}, | ||
...options, | ||
}); | ||
}, | ||
}; | ||
|
||
export default vuePluginSentry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<template> | ||
<div class="flex flex-col"> | ||
<FormKit type="form" @submit="saveAccount" :submit-label="__('Save Account')" :submit-attrs="{ wrapperClass: 'flex justify-end' }"> | ||
<!-- Name --> | ||
<div class="flex flex-row flex-wrap gap-2"> | ||
<FormKit type="text" name="firstName" :value="firstName" :label="__('First name')" :placeholder="__('Marvin')" :classes="{ outer: 'flex-grow' }" /> | ||
<FormKit type="text" name="lastName" :value="lastName" :label="__('Last name')" :placeholder="__('Martian')" :classes="{ outer: 'flex-grow' }" /> | ||
</div> | ||
|
||
<!-- Username --> | ||
<FormKit type="text" name="username" :value="user?.username" :label="__('Username')" :placeholder="__('marvin')" /> | ||
|
||
<!-- Email --> | ||
<FormKit type="email" name="email" :value="user?.email" :label="__('Email')" :placeholder="__('[email protected]')" /> | ||
</FormKit> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from "vue"; | ||
import { useUserStore } from "@/stores/user"; | ||
import { mapState, mapActions } from "pinia"; | ||
interface SaveAccountData { | ||
firstName: string; | ||
lastName: string; | ||
username: string; | ||
email: string; | ||
} | ||
export default defineComponent({ | ||
name: "AccountView", | ||
computed: { | ||
firstName() { | ||
return this.user?.display_name?.split(" ")[0]; | ||
}, | ||
lastName() { | ||
return this.user?.display_name?.split(" ")[1]; | ||
}, | ||
...mapState(useUserStore, ["user"]), | ||
}, | ||
methods: { | ||
saveAccount(data: SaveAccountData) { | ||
this.updateUser({ | ||
display_name: `${data.firstName} ${data.lastName}`, | ||
username: data.username, | ||
email: data.email, | ||
}); | ||
}, | ||
...mapActions(useUserStore, ["updateUser"]), | ||
}, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters