add: registration page
This commit is contained in:
@ -169,6 +169,66 @@ export interface OperationsResponse {
|
||||
operations: MarketplaceOperation[];
|
||||
}
|
||||
|
||||
export interface RegisterUserResponse {
|
||||
status: string;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
export interface GenerateVerificationCodeResponse {
|
||||
status: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
export interface VerificationStatusResponse {
|
||||
is_verified: boolean;
|
||||
}
|
||||
|
||||
export async function getVerificationStatus(
|
||||
username: string,
|
||||
): Promise<VerificationStatusResponse> {
|
||||
const response = await fetch(
|
||||
`${API_BASE_URL}/auth/verification_status/${username}`,
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error('Не удалось получить статус верификации');
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function generateVerificationCode(
|
||||
username: string,
|
||||
): Promise<GenerateVerificationCodeResponse> {
|
||||
const response = await fetch(
|
||||
`${API_BASE_URL}/auth/generate_code?username=${username}`,
|
||||
{
|
||||
method: 'POST',
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error('Не удалось сгенерировать код верификации');
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
export async function registerUser(
|
||||
username: string,
|
||||
password: string,
|
||||
): Promise<RegisterUserResponse> {
|
||||
const response = await fetch(`${API_BASE_URL}/auth/register`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username,
|
||||
password,
|
||||
}),
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error('Не удалось зарегистрировать пользователя');
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function getPlayerInventory(
|
||||
request_id: string,
|
||||
): Promise<PlayerInventory> {
|
||||
|
Reference in New Issue
Block a user