api ulangan
This commit is contained in:
29
src/features/users/lib/api.ts
Normal file
29
src/features/users/lib/api.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import type { UserCreateReq, UserListRes } from "@/features/users/lib/data";
|
||||
import httpClient from "@/shared/config/api/httpClient";
|
||||
import { API_URLS } from "@/shared/config/api/URLs";
|
||||
import { type AxiosResponse } from "axios";
|
||||
|
||||
export const user_api = {
|
||||
async list(params: {
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}): Promise<AxiosResponse<UserListRes>> {
|
||||
const res = await httpClient.get(`${API_URLS.UsesList}`, { params });
|
||||
return res;
|
||||
},
|
||||
|
||||
async update({ body, id }: { id: string; body: UserCreateReq }) {
|
||||
const res = await httpClient.patch(`${API_URLS.UserUpdate(id)}`, body);
|
||||
return res;
|
||||
},
|
||||
|
||||
async create(body: UserCreateReq) {
|
||||
const res = await httpClient.post(`${API_URLS.UserCreate}`, body);
|
||||
return res;
|
||||
},
|
||||
|
||||
async delete({ id }: { id: string }) {
|
||||
const res = await httpClient.delete(`${API_URLS.UserDelete(id)}`);
|
||||
return res;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user