feat: похуйу

This commit is contained in:
2026-05-12 21:50:41 +03:00
parent 36c63a2597
commit e310eafa1e
3 changed files with 25 additions and 5 deletions

View File

@@ -0,0 +1,21 @@
import { getCsrfToken } from '@shared/api/csrf'
import { tokenStore } from '@shared/api/tokenStore'
const USERS_API_URL = 'https://app.users.elcsa.ru'
export async function getMe(): Promise<unknown> {
const csrf = await getCsrfToken()
const bearer = tokenStore.get()
const res = await fetch(`${USERS_API_URL}/me`, {
credentials: 'include',
headers: {
'X-CSRF-Token': csrf,
...(bearer ? { Authorization: `Bearer ${bearer}` } : {}),
},
})
const data = await res.json()
if (!res.ok) throw data
return data
}

View File

@@ -1,4 +1,5 @@
export { registrationStart, registrationComplete, loginStart, loginComplete } from './api/registrationApi'
export { getMe } from './api/profileApi'
export type { RegistrationStartPayload, RegistrationCompletePayload, LoginStartPayload, LoginCompletePayload, AuthResponse } from './api/registrationApi'
export { useIsAuthenticated } from './hooks/useIsAuthenticated'
export { useAuth, AUTH_QUERY_KEY } from './hooks/useAuth'