12345678910111213141516171819202122232425 |
- import { CreateUserResponse } from '../utils/interface/userInterface';
- import apiEndpoints from './apiEndpoints';
-
- export const createUser = async (
- fullName: string,
- username: string,
- email: string,
- password: string
- ): Promise<CreateUserResponse> => {
- const response = await fetch(apiEndpoints.account.createUser, {
- method: 'POST',
- body: JSON.stringify({ fullName, username, email, password }),
- headers: {
- 'Content-Type': 'application/json',
- },
- });
-
- const data: CreateUserResponse = await response.json();
-
- if (!response.ok) {
- throw new Error(data.message || 'Something went wrong!');
- }
-
- return data;
- };
|