fitst commit

This commit is contained in:
Samandar Turgunboyev
2026-01-28 18:26:50 +05:00
parent 166a55b1e9
commit 124798419b
196 changed files with 26627 additions and 421 deletions

View File

@@ -0,0 +1,55 @@
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;
},
};

View File

@@ -0,0 +1,20 @@
import { create } from 'zustand';
type State = {
phone: string | null;
userType: string | null;
};
type Actions = {
savedPhone: (phone: string | null) => void;
savedUserType: (userType: string | null) => void;
};
const userInfoStore = create<State & Actions>((set) => ({
phone: null,
savedPhone: (phone: string | null) => set(() => ({ phone })),
userType: null,
savedUserType: (userType: string | null) => set(() => ({ userType })),
}));
export default userInfoStore;