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" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>ЭКСА — Ваш мост в мир цифровых активов</title>
|
||||
<script type="module" crossorigin src="/assets/index-DNMSK_QC.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Gd4LQhAo.css">
|
||||
<script type="module" crossorigin src="/assets/index-DnBv2hbv.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-3J8Zo9Sf.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -9,5 +9,7 @@ export function useAuth() {
|
||||
queryFn: refreshAccessToken,
|
||||
retry: false,
|
||||
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 {
|
||||
status: boolean
|
||||
@@ -9,6 +11,22 @@ export interface KycResponse {
|
||||
qr_code: string
|
||||
}
|
||||
|
||||
export function kycCreate(): Promise<KycResponse> {
|
||||
return api.post<KycResponse>('/kyc/create', {})
|
||||
export async function kycCreate(): Promise<KycResponse> {
|
||||
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 KYC_API_URL = import.meta.env.VITE_KYC_API_URL as string
|
||||
|
||||
Reference in New Issue
Block a user