mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-09-19 09:40:13 +00:00
23 lines
889 B
TypeScript
23 lines
889 B
TypeScript
import { ModelProfile, ModelUserForm, ModelProfileForm } from "@/types"
|
|
import { fetcher, FetcherMethod } from "./api"
|
|
|
|
export const getProfile = async (): Promise<ModelProfile> => {
|
|
return fetcher<ModelProfile>(FetcherMethod.GET, '/api/v1/profile', null);
|
|
}
|
|
|
|
export const login = async (username: string, password: string): Promise<void> => {
|
|
return fetcher<void>(FetcherMethod.POST, '/api/v1/login', { username, password });
|
|
}
|
|
|
|
export const createUser = async (data: ModelUserForm): Promise<number> => {
|
|
return fetcher<number>(FetcherMethod.POST, '/api/v1/user', data);
|
|
}
|
|
|
|
export const deleteUser = async (id: number[]): Promise<void> => {
|
|
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/user', id);
|
|
}
|
|
|
|
export const updateProfile = async (data: ModelProfileForm): Promise<void> => {
|
|
return fetcher<void>(FetcherMethod.POST, '/api/v1/profile', data);
|
|
}
|