chore: update frontend configuration

This commit is contained in:
Matthieu
2025-09-26 11:29:47 +02:00
parent b7caa4f552
commit a78938a4d1
64 changed files with 5790 additions and 5129 deletions

View File

@@ -6,13 +6,13 @@ const buildUrl = (path) => {
return `${base}${path}`
}
export function useProfileSession() {
export function useProfileSession () {
const activeProfile = useState('profileSession:active', () => null)
const sessionLoaded = useState('profileSession:loaded', () => false)
const loading = useState('profileSession:loading', () => false)
const getSessionHeaders = () => {
if (!process.server) return undefined
if (!process.server) { return undefined }
const headers = useRequestHeaders(['cookie'])
return headers?.cookie ? { cookie: headers.cookie } : undefined
}
@@ -23,7 +23,7 @@ export function useProfileSession() {
activeProfile.value = await $fetch(buildUrl('/session/profile'), {
method: 'GET',
credentials: 'include',
headers: getSessionHeaders(),
headers: getSessionHeaders()
})
} catch (error) {
if (error?.status === 401) {
@@ -51,7 +51,7 @@ export function useProfileSession() {
method: 'POST',
credentials: 'include',
body: { profileId },
headers: getSessionHeaders(),
headers: getSessionHeaders()
})
await fetchCurrentProfile()
}
@@ -61,7 +61,7 @@ export function useProfileSession() {
await $fetch(buildUrl('/session/profile'), {
method: 'DELETE',
credentials: 'include',
headers: getSessionHeaders(),
headers: getSessionHeaders()
})
} finally {
activeProfile.value = null
@@ -76,6 +76,6 @@ export function useProfileSession() {
ensureSession,
fetchCurrentProfile,
activateProfile,
logout,
logout
}
}