feat: create user API
This commit is contained in:
@ -29,3 +29,28 @@ export const adminGetUserApi = async (
|
|||||||
|
|
||||||
return response.data;
|
return response.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export interface CreateUserRequest {
|
||||||
|
email: string;
|
||||||
|
full_name: string;
|
||||||
|
password: string;
|
||||||
|
is_admin: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateUserResponse {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const postUser = async (
|
||||||
|
req: CreateUserRequest,
|
||||||
|
): Promise<CreateUserResponse> => {
|
||||||
|
const response = await axios.post<CreateUserResponse>(
|
||||||
|
"/api/v1/admin/users",
|
||||||
|
req,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.status !== 200 && response.status !== 201)
|
||||||
|
throw await handleApiError(response);
|
||||||
|
|
||||||
|
return response.data;
|
||||||
|
};
|
||||||
|
Reference in New Issue
Block a user