chore: update frontend configuration
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user