2023-08-11 11:48:33 +00:00
|
|
|
// services
|
|
|
|
import APIService from "services/api.service";
|
2023-09-13 14:51:02 +00:00
|
|
|
import { API_BASE_URL } from "helpers/common.helper";
|
2023-08-11 11:48:33 +00:00
|
|
|
|
|
|
|
class UserService extends APIService {
|
|
|
|
constructor() {
|
2023-09-13 14:51:02 +00:00
|
|
|
super(API_BASE_URL);
|
2023-08-11 11:48:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async currentUser(): Promise<any> {
|
|
|
|
return this.get("/api/users/me/")
|
|
|
|
.then((response) => response?.data)
|
|
|
|
.catch((error) => {
|
|
|
|
throw error?.response;
|
|
|
|
});
|
|
|
|
}
|
2023-09-01 11:12:30 +00:00
|
|
|
|
|
|
|
async updateMe(data: any): Promise<any> {
|
|
|
|
return this.patch("/api/users/me/", data)
|
|
|
|
.then((response) => response?.data)
|
|
|
|
.catch((error) => {
|
|
|
|
throw error?.response?.data;
|
|
|
|
});
|
|
|
|
}
|
2023-08-11 11:48:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default UserService;
|