feat: create kyc page with api
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
dist/index.html
vendored
4
dist/index.html
vendored
@@ -5,8 +5,8 @@
|
|||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>ЭКСА — Ваш мост в мир цифровых активов</title>
|
<title>ЭКСА — Ваш мост в мир цифровых активов</title>
|
||||||
<script type="module" crossorigin src="/assets/index-DNMSK_QC.js"></script>
|
<script type="module" crossorigin src="/assets/index-DnBv2hbv.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-Gd4LQhAo.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-3J8Zo9Sf.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@@ -9,5 +9,7 @@ export function useAuth() {
|
|||||||
queryFn: refreshAccessToken,
|
queryFn: refreshAccessToken,
|
||||||
retry: false,
|
retry: false,
|
||||||
staleTime: Infinity,
|
staleTime: Infinity,
|
||||||
|
gcTime: Infinity,
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { api } from '@shared/api/base'
|
import { KYC_API_URL } from '@shared/config/env'
|
||||||
|
import { getCsrfToken } from '@shared/api/csrf'
|
||||||
|
import { tokenStore } from '@shared/api/tokenStore'
|
||||||
|
|
||||||
export interface KycResponse {
|
export interface KycResponse {
|
||||||
status: boolean
|
status: boolean
|
||||||
@@ -9,6 +11,22 @@ export interface KycResponse {
|
|||||||
qr_code: string
|
qr_code: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function kycCreate(): Promise<KycResponse> {
|
export async function kycCreate(): Promise<KycResponse> {
|
||||||
return api.post<KycResponse>('/kyc/create', {})
|
const csrf = await getCsrfToken()
|
||||||
|
const bearer = tokenStore.get()
|
||||||
|
|
||||||
|
const res = await fetch(`${KYC_API_URL}/kyc/create`, {
|
||||||
|
method: 'POST',
|
||||||
|
credentials: 'include',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-CSRF-Token': csrf,
|
||||||
|
...(bearer ? { Authorization: `Bearer ${bearer}` } : {}),
|
||||||
|
},
|
||||||
|
body: JSON.stringify({}),
|
||||||
|
})
|
||||||
|
|
||||||
|
const data = await res.json()
|
||||||
|
if (!res.ok) throw data
|
||||||
|
return data as KycResponse
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
export const API_URL = import.meta.env.VITE_API_URL as string
|
export const API_URL = import.meta.env.VITE_API_URL as string
|
||||||
|
export const KYC_API_URL = import.meta.env.VITE_KYC_API_URL as string
|
||||||
|
|||||||
Reference in New Issue
Block a user