feat: fetch users API
This commit is contained in:
16
web/src/api/admin/users.ts
Normal file
16
web/src/api/admin/users.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import type { UserProfile } from "@/types";
|
||||||
|
import { axios, handleApiError } from "..";
|
||||||
|
|
||||||
|
export interface FetchUsersResponse {
|
||||||
|
items: UserProfile[];
|
||||||
|
count: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const adminGetUsersApi = async (): Promise<FetchUsersResponse> => {
|
||||||
|
const response = await axios.get<FetchUsersResponse>("/api/v1/admin/users");
|
||||||
|
|
||||||
|
if (response.status !== 200 && response.status !== 201)
|
||||||
|
throw await handleApiError(response);
|
||||||
|
|
||||||
|
return response.data;
|
||||||
|
};
|
Reference in New Issue
Block a user