mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
29 lines
671 B
TypeScript
29 lines
671 B
TypeScript
// services
|
|
import APIService from "@/services/api.service";
|
|
// helpers
|
|
import { API_BASE_URL } from "@/helpers/common.helper";
|
|
// types
|
|
import { IUser } from "types/user";
|
|
|
|
export class UserService extends APIService {
|
|
constructor() {
|
|
super(API_BASE_URL);
|
|
}
|
|
|
|
async currentUser(): Promise<IUser> {
|
|
return this.get("/api/users/me/")
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response;
|
|
});
|
|
}
|
|
|
|
async updateMe(data: any): Promise<any> {
|
|
return this.patch("/api/users/me/", data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
}
|