implement setting page (#12)

This commit is contained in:
UUBulb
2024-11-23 21:59:48 +08:00
committed by GitHub
parent f17bdbf760
commit 3b5023061b
21 changed files with 941 additions and 36 deletions
+11 -3
View File
@@ -1,10 +1,18 @@
import { ModelUser } from "@/types"
import { ModelProfile, ModelUserForm } from "@/types"
import { fetcher, FetcherMethod } from "./api"
export const getProfile = async (): Promise<ModelUser> => {
return fetcher<ModelUser>(FetcherMethod.GET, '/api/v1/profile', null);
export const getProfile = async (): Promise<ModelProfile> => {
return fetcher<ModelProfile>(FetcherMethod.GET, '/api/v1/profile', null);
}
export const login = async (username: string, password: string): Promise<any> => {
return fetcher<any>(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);
}