From a2c04af8cee8b14c93a1ebde7c44f20be80ed59f Mon Sep 17 00:00:00 2001 From: JustTemmie <47639983+JustTemmie@users.noreply.github.com> Date: Sun, 1 Jun 2025 16:36:59 +0200 Subject: [PATCH] feat: basic user popup implemented --- components/Userpopup.vue | 79 +++++++++++++++++++ components/settings/user_settings/Account.vue | 20 +++-- composables/auth.ts | 16 +++- pages/settings.vue | 21 ++++- types/interfaces.ts | 1 + 5 files changed, 128 insertions(+), 9 deletions(-) create mode 100644 components/Userpopup.vue diff --git a/components/Userpopup.vue b/components/Userpopup.vue new file mode 100644 index 0000000..1e90026 --- /dev/null +++ b/components/Userpopup.vue @@ -0,0 +1,79 @@ + + + + + \ No newline at end of file diff --git a/components/settings/user_settings/Account.vue b/components/settings/user_settings/Account.vue index e137031..9b7d044 100644 --- a/components/settings/user_settings/Account.vue +++ b/components/settings/user_settings/Account.vue @@ -3,14 +3,14 @@

My Account

- +

Password (and eventually authenticator)

- +

Account Deletion

- + @@ -19,7 +19,9 @@ import Button from '~/components/buttons/Button.vue'; import ButtonScary from '~/components/buttons/ButtonScary.vue'; -const { user } = useAuth(); +const { user, fetchUser } = useAuth(); + +const user_me = await fetchUser() const resetPassword = async () => { @@ -27,11 +29,17 @@ const resetPassword = async () => { // await fetchWithApi(`/auth/reset-password`); } -const deleteAccount = () => { +const deleteAccount = async () => { alert("TBD") } \ No newline at end of file diff --git a/composables/auth.ts b/composables/auth.ts index 19ac694..0ac2e8b 100644 --- a/composables/auth.ts +++ b/composables/auth.ts @@ -75,7 +75,7 @@ export const useAuth = () => { async function fetchUser() { if (!accessToken.value) return; console.log("fetchuser access token:", accessToken.value); - const res = await fetchWithApi("/users/me") as UserResponse; + const res = await fetchWithApi("/me") as UserResponse; user.value = res; return user.value; } @@ -88,6 +88,20 @@ export const useAuth = () => { return user.value; } + + // as in email the password link + async function resetPassword() { + // ... + } + + async function disableAccount() { + // ... + } + + async function deleteAccount() { + // ... + } + return { accessToken, register, diff --git a/pages/settings.vue b/pages/settings.vue index 9e7d420..050c1f8 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -69,17 +69,34 @@ const settingsCategories = { { display_name: "Language", page_data: Language }, ] }, + app_settings2: { + display_name: "App Settings", + pages: [ + { display_name: "Appearance", page_data: Appearance }, + { display_name: "Notifications", page_data: Notifications }, + { display_name: "Keybinds", page_data: Keybinds }, + { display_name: "Language", page_data: Language }, + ] + }, + app_settings3: { + display_name: "App Settings", + pages: [ + { display_name: "Appearance", page_data: Appearance }, + { display_name: "Notifications", page_data: Notifications }, + { display_name: "Keybinds", page_data: Keybinds }, + { display_name: "Language", page_data: Language }, + ] + }, }; const categories = Object.values(settingsCategories); let currentPage = ref(categories[0].pages[0]); -let selectedPage = ref(currentPage.value.display_name); +let selectedPage = ref(currentPage.value.display_name); // used to highlight the current channel const selectCategory = (_category: Category, page: Page) => { currentPage.value = page; selectedPage.value = page.display_name; - console.log(`switching to ${page.display_name}`) }; diff --git a/types/interfaces.ts b/types/interfaces.ts index b4869e2..cd4b6dd 100644 --- a/types/interfaces.ts +++ b/types/interfaces.ts @@ -58,6 +58,7 @@ export interface UserResponse { username: string, display_name: string | null, avatar: string | null, + pronouns: string | null, email?: string, email_verified?: boolean }