From b90e5e8f2db42186ebf4e4d2112bf8e3416b082e Mon Sep 17 00:00:00 2001 From: Sandeep Ramgolam Date: Tue, 30 Jan 2024 23:37:16 +0400 Subject: [PATCH 01/10] implement full name --- src/auth-utils/useAuth.ts | 13 +- src/components/auth/MyProfile.vue | 341 ++++++++++++++---------------- src/components/auth/SideInfo.vue | 14 ++ 3 files changed, 177 insertions(+), 191 deletions(-) create mode 100644 src/components/auth/SideInfo.vue diff --git a/src/auth-utils/useAuth.ts b/src/auth-utils/useAuth.ts index 732d14b4..49c98161 100644 --- a/src/auth-utils/useAuth.ts +++ b/src/auth-utils/useAuth.ts @@ -161,6 +161,7 @@ export default function useAuth(client: DirectusClient & AuthenticationClie "id", "first_name", "last_name", + "full_name", "email", "phone", "transport", @@ -224,16 +225,14 @@ export default function useAuth(client: DirectusClient & AuthenticationClie async function updateUserProfile( { profile_updates, - event_id, - rsvp_updates, + // event_id, + // rsvp_updates, }: { profile_updates: DirectusAstroUser, - event_id: string, - rsvp_updates: RSVPMetaData, + // event_id: string, + // rsvp_updates: RSVPMetaData, }) { - console.log(rsvp_updates) - try { isLoading.value = true; const token = getCookieValue('access_token') @@ -254,7 +253,7 @@ export default function useAuth(client: DirectusClient & AuthenticationClie const result = await client.request(updateMe(profile_updates)); console.log('profile updated') - await updateRsvp(event_id, rsvp_updates) + // await updateRsvp(event_id, rsvp_updates) await getCurrentUser(); diff --git a/src/components/auth/MyProfile.vue b/src/components/auth/MyProfile.vue index 754aaeb7..59dc88ae 100644 --- a/src/components/auth/MyProfile.vue +++ b/src/components/auth/MyProfile.vue @@ -3,6 +3,7 @@ import { computed, onMounted, reactive } from 'vue'; import useAuth, { getClient } from '../../auth-utils/useAuth'; import BaseButton from '@components/base/BaseButton.vue'; import { base64Url } from '@utils/helpers'; +import SideInfo from './SideInfo.vue' const { user, rawUser, @@ -13,7 +14,8 @@ const { responseFromServer, checkIfLoggedIn, updateUserProfile, - oAuthLogin + oAuthLogin, + avatarUrl } = useAuth(getClient()); const userDetails = reactive({ @@ -49,239 +51,210 @@ function updateProfile() { let extractEditableFields = { phone: userDetails.phone, transport: userDetails.transport, + full_name: userDetails.full_name, meal: userDetails.meal, occupation: userDetails.occupation, github_username: userDetails.github_username } - // updateUserProfile(extractEditableFields); + updateUserProfile({ + profile_updates: extractEditableFields, + }); } - -// Avatar based on github username - - -const avatar = computed(() => { - if (userDetails?.profile_picture) { - return base64Url(userDetails.profile_picture) - } - return false; -}) -