2023-08-11 11:48:33 +00:00
|
|
|
// services
|
|
|
|
import APIService from "services/api.service";
|
|
|
|
|
|
|
|
class UserService extends APIService {
|
|
|
|
constructor() {
|
2023-08-21 19:43:51 +00:00
|
|
|
super(process.env.NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000");
|
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;
|