🐛 fixing profile data and some QA issues

This commit is contained in:
ChatonDeAru
2024-09-26 16:14:57 +02:00
parent 622841eed3
commit 4bc3a58b3e
18 changed files with 121 additions and 61 deletions

View File

@@ -1,13 +0,0 @@
export const useAuth = () => {
const user = useSupabaseUser()
const { auth } = useSupabaseClient()
auth.onAuthStateChange(async (event) => {
if (event === 'SIGNED_OUT')
navigateTo('/')
})
return {
user
}
}

View File

@@ -2,7 +2,7 @@ export const useFoStyle = () => {
return {
inputStyle: {
ui: {
placeholder: 'placeholder-transparent',
placeholder: 'placeholder-transparent dark:placeholder-transparent',
},
attrs: {
variant: 'none'
@@ -10,10 +10,11 @@ export const useFoStyle = () => {
},
formGroupStyle: {
ui: {
wrapper: 'flex flex-col md:flex-row rounded-lg py-1 px-4 border-b-2 border-orange-500 has-[:focus]:bg-orange-100 has-[:focus]:border-t-2 has-[:focus]:border-x-2 has-[:focus]:border-b-0 mb-6',
wrapper: 'flex flex-col relative md:flex-row rounded-lg py-1 px-4 border-b-2 border-orange-500 has-[:focus]:bg-orange-100 dark:border-orange-500 dark:has-[:focus]:bg-orange-800 has-[:focus]:border-t-2 has-[:focus]:border-x-2 has-[:focus]:border-b-0 mb-6',
inner: 'flex-2 content-center',
container: 'flex-1 mt-auto relative',
container: 'flex-1 mt-auto position-unset',
error: 'text-red-500 text-sm absolute top[-100%] left-0 mt-2 pointer-events-none',
help: 'absolute top[-100%] left-0 mt-2 pointer-events-none',
},
},
}

View File

@@ -7,7 +7,9 @@ export const useProfile = () => {
const profile = ref<{
firstname: string
lastname: string
displayname?: string
displayname: string | null
email: string
is_validated: boolean
} | null>(null)
const displayName = computed(() => {
@@ -37,8 +39,13 @@ export const useProfile = () => {
return
}
const { data, error } = await client.from('profiles').select('id,firstname,lastname,displayname,mail').eq('id', user.value.id).single()
return data
const { data, error } = await client.from('profiles').select('id,firstname,lastname,displayname,email,is_validated').eq('id', user.value.id).single()
if (!error) {
return data
}
return null
})
if (error.value) {
@@ -53,6 +60,8 @@ export const useProfile = () => {
watch(user, (user) => {
if (user && !loading.value) {
getProfile()
} else {
profile.value = null
}
}, { immediate: true })