mirror of
https://github.com/makeplane/plane.git
synced 2025-12-25 16:19:43 +01:00
* fix: lint config package updates * fix: tsconfig changes * fix: lint config setup * fix: lint errors and adding new rules * fix: lint errors * fix: ui and editor lints * fix: build error * fix: editor tsconfig * fix: lint errors * fix: types fixes --------- Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so> Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
31 lines
788 B
TypeScript
31 lines
788 B
TypeScript
// types
|
|
import type { IUser } from "@plane/types";
|
|
// helpers
|
|
import { API_BASE_URL } from "@/helpers/common.helper";
|
|
// services
|
|
import { APIService } from "@/services/api.service";
|
|
|
|
interface IUserSession extends IUser {
|
|
isAuthenticated: boolean;
|
|
}
|
|
|
|
export class UserService extends APIService {
|
|
constructor() {
|
|
super(API_BASE_URL);
|
|
}
|
|
|
|
async authCheck(): Promise<IUserSession> {
|
|
return this.get<any>("/api/instances/admins/me/")
|
|
.then((response) => ({ ...response?.data, isAuthenticated: true }))
|
|
.catch(() => ({ isAuthenticated: false }));
|
|
}
|
|
|
|
async currentUser(): Promise<IUser> {
|
|
return this.get<IUser>("/api/instances/admins/me/")
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response;
|
|
});
|
|
}
|
|
}
|