feat: похуйу
This commit is contained in:
@@ -1,17 +1,33 @@
|
||||
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> {
|
||||
export interface MeResponse {
|
||||
id: string
|
||||
email: string
|
||||
first_name: string
|
||||
middle_name: string
|
||||
last_name: string
|
||||
birth_date: string
|
||||
crypto_wallet: string | null
|
||||
phone: string
|
||||
passport_data: string | null
|
||||
inn: string | null
|
||||
erc20: string | null
|
||||
kyc_verified: boolean
|
||||
is_deleted: boolean
|
||||
created_at: string
|
||||
updated_at: string
|
||||
kyc_verified_at: string | null
|
||||
}
|
||||
|
||||
export async function getMe(): Promise<MeResponse> {
|
||||
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}` } : {}),
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user