Files
info-target-mobile/screens/auth/login/lib/api.ts
Samandar Turgunboyev 124798419b fitst commit
2026-01-28 18:26:50 +05:00

56 lines
1.4 KiB
TypeScript

import httpClient from '@/api/httpClient';
import { API_URLS } from '@/api/URLs';
import axios, { AxiosResponse } from 'axios';
interface ConfirmBody {
status: boolean;
data: {
detail: string;
token: {
access: string;
refresh: string;
};
};
}
export const auth_api = {
async login(body: { phone: string }) {
const res = await httpClient.post(API_URLS.LOGIN, body);
return res;
},
async verify_otp(body: { code: string; phone: string }): Promise<AxiosResponse<ConfirmBody>> {
const res = await httpClient.post(API_URLS.LoginConfirm, body);
return res;
},
async resend_otp(body: { phone: string }) {
const res = await httpClient.post(API_URLS.ResendOTP, body);
return res;
},
async get_info(inn: string) {
const res = await axios.get(`https://devapi.goodsign.biz/v1/profile/${inn}`);
return res;
},
async register(body: {
phone: string;
stir: string;
person_type: string;
activate_types: number[];
}) {
const res = await httpClient.post(API_URLS.Register, body);
return res;
},
async register_confirm(body: { phone: string; code: string }) {
const res = await httpClient.post(API_URLS.Register_Confirm, body);
return res;
},
async register_resend(body: { phone: string }) {
const res = await httpClient.post(API_URLS.Register_Resend, body);
return res;
},
};