user account create

This commit is contained in:
yaschalew
2026-05-26 05:40:53 +03:00
parent 69db7cd960
commit 5a4d6baec2
24 changed files with 3387 additions and 1817 deletions

View File

@@ -0,0 +1,81 @@
import { URL_CONSTANTS } from "@/constants/URLS";
import { CreateUserPayload } from "@/types/createUser";
import { VerificationCodePayload } from "@/types/generateVerificationCode";
import { UserTypeRequest } from "@/types/userTypeRequest";
import { client } from "@/utils/api";
import { ApiResponse } from "@edr/types";
import { GenerateVerifcationCodePayload } from "node_modules/@tria-plc/iamui-common/dist/types/shared/services/authService";
// -----------------------------------------------------------------------------
// API
// -----------------------------------------------------------------------------
export const createUser = async (
body: CreateUserPayload
) => {
const res =
await client.post<
ApiResponse<any>
>(
URL_CONSTANTS.USERS.SIGN_UP,
body
);
return res.data;
};
export const generateVerificationCode = async (
body: VerificationCodePayload
) => {
const res =
await client.patch<
ApiResponse<string>
>(
URL_CONSTANTS.USERS.GENERATE_VERIFICATION_CODE,
body
);
return res.data.data;
};
export const setPassword = async (
body: any
) => {
const res =
await client.patch<
ApiResponse<string>
>(
URL_CONSTANTS.USERS.SET_PASSWORD,
body
);
return res.data.data;
};
export const createOTP = async (
body: any
) => {
const res =
await client.post<
ApiResponse<any>
>(
URL_CONSTANTS.OTP.SEND,
body
);
return res.data;
};
export const verifyOTP = async (
body: any
) => {
const res =
await client.post<
ApiResponse<any>
>(
URL_CONSTANTS.OTP.VERIFY,
body
);
return res.data;
};

View File

@@ -133,5 +133,5 @@ export const getFileUploadSettingByCode = endpoint<string, FileUploadSetting>(
.get<
ApiResponse<FileUploadSetting>
>(`${URL_CONSTANTS.FILES.FILE_UPLOAD_SETTINGS_BY_CODE}/${code}`)
.then((res) => res.data.data),
.then((res: any) => res.data.data),
);