- добавлен новый Nest backend для auth, projects и project access tokens - добавлена control-plane схема БД и миграция Drizzle - перенесён старый backend в old-backend - добавлен React/Vite cabinet с auth-only входом и Mantine layout - обновлены workspace scripts и lockfile
21 lines
483 B
TypeScript
21 lines
483 B
TypeScript
import { useSWRConfig } from 'swr'
|
|
import { clearAdminToken, getAdminSessionKey } from 'infra/backend-api'
|
|
|
|
import type { LogoutAction } from '../types/auth-api.type'
|
|
|
|
/**
|
|
* Сценарий выхода администратора.
|
|
*/
|
|
export const useLogout = (): LogoutAction => {
|
|
const { mutate } = useSWRConfig()
|
|
|
|
const logout = async () => {
|
|
clearAdminToken()
|
|
await mutate(getAdminSessionKey(), undefined, { revalidate: false })
|
|
}
|
|
|
|
return {
|
|
logout,
|
|
}
|
|
}
|