Add the API Client to all rest resources
This commit is contained in:
parent
0dc3264a22
commit
709cb23f3d
6 changed files with 29 additions and 53 deletions
|
|
@ -5,22 +5,24 @@ import type {ChangeUserPasswordRequest} from "../dtos/ChangeUserPasswordRequest.
|
|||
import type {CreateUserResponse} from "../dtos/CreateUserResponse.ts";
|
||||
import type {UserListResponse} from "../dtos/UserListResponse.ts";
|
||||
|
||||
const USER_URL = "/user"
|
||||
|
||||
export async function fetchCurrentUser(): Promise<UserDto> {
|
||||
return apiClient.get("/user/me");
|
||||
return apiClient.get(`${USER_URL}/me`);
|
||||
}
|
||||
|
||||
export async function fetchAllUsers(): Promise<UserListResponse> {
|
||||
return apiClient.get("/user/all");
|
||||
return apiClient.get(`${USER_URL}/all`);
|
||||
}
|
||||
|
||||
export async function createUser(dto: CreateUserRequest): Promise<CreateUserResponse> {
|
||||
return apiClient.post("/user/create", dto);
|
||||
return apiClient.post(`${USER_URL}/create`, dto);
|
||||
}
|
||||
|
||||
export async function updateUser(dto: UserDto): Promise<UserDto> {
|
||||
return apiClient.post("/user/update", dto);
|
||||
return apiClient.post(`${USER_URL}/update`, dto);
|
||||
}
|
||||
|
||||
export async function changePassword(dto: ChangeUserPasswordRequest) {
|
||||
return apiClient.post("/user/change-password", dto);
|
||||
return apiClient.post(`${USER_URL}/change-password`, dto);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue