fix: fix logout + fix protected route
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { api } from '@shared/api/base'
|
||||
import { getCsrfToken } from '@shared/api/csrf'
|
||||
|
||||
export interface RegistrationStartPayload {
|
||||
email: string
|
||||
@@ -19,6 +20,7 @@ export function registrationComplete(payload: RegistrationCompletePayload): Prom
|
||||
return api.post<string>('/auth/registration/complete', payload)
|
||||
}
|
||||
|
||||
export function logout(): Promise<void> {
|
||||
return api.post<void>('/logout', {})
|
||||
export async function logout(): Promise<void> {
|
||||
const csrfToken = await getCsrfToken()
|
||||
return api.post<void>('/logout', { _csrf: csrfToken })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user