feat: добавить новый backend и cabinet
- добавлен новый Nest backend для auth, projects и project access tokens - добавлена control-plane схема БД и миграция Drizzle - перенесён старый backend в old-backend - добавлен React/Vite cabinet с auth-only входом и Mantine layout - обновлены workspace scripts и lockfile
This commit is contained in:
20
apps/cabinet/src/business/auth/hooks/use-logout.hook.ts
Normal file
20
apps/cabinet/src/business/auth/hooks/use-logout.hook.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user