mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-09-19 17:50:13 +00:00
fix validation & implement profile page (#5)
* fix validation * implement profile page * catch error
This commit is contained in:
+7
-3
@@ -1,12 +1,12 @@
|
||||
import { ModelProfile, ModelUserForm } from "@/types"
|
||||
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<any> => {
|
||||
return fetcher<any>(FetcherMethod.POST, '/api/v1/login', { username, password });
|
||||
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> => {
|
||||
@@ -16,3 +16,7 @@ export const createUser = async (data: ModelUserForm): Promise<number> => {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user