This commit is contained in:
2026-04-08 16:16:26 +07:00
parent 8f71d46652
commit 30a2286f52
13 changed files with 718 additions and 67 deletions

View File

@@ -3,8 +3,31 @@ import { API } from "../../api";
import { getUserDto } from "@/interface/admin";
export const apiGetListUser = async (payload: getUserDto) => {
const response = await api.get(API.Admin.GET_LIST_USERS, {
const response = await api.get(API.Admin.GET_LIST_USERS, {
params: payload,
});
return response?.data;
};
export const apiChangeRole = async (id: string, payload: any) => {
const response = await api.patch(API.Admin.CHANGE_ROLE(id), payload);
console.log("Response từ API sau khi đổi role:", response);
return response?.data;
};
export const apiDeleteUser = async (id: string) => {
const response = await api.delete(API.Admin.DELETE_USER(id));
return response?.data;
};
export const apiRestoreUser = async (id: string) => {
const response = await api.patch(API.Admin.RESTORE_USER(id));
return response?.data;
};
export const apiGetAllRole = async () => {
const response = await api.get(API.Admin.GET_ALL_ROLE);
return response?.data;
};
export const apiGetUserMedia = async (id: string) => {
const response = await api.get(API.Admin.GET_USER_MEDIA(id));
return response?.data;
};

View File

@@ -31,6 +31,11 @@ export const apiSignIn = async (payload: any) => {
return response.data;
};
export const apiResetPassword = async (payload: any) => {
const response = await api.post(API.Auth.FORGOT_PASSWORD, payload);
return response.data;
};
export const apiGetCurrentUser = async () => {
const response = await api.get(API.User.CURRENT);
return response?.data;