plane/space/services/auth.service.ts
guru_sainath bab52a2672
[WEB-1319] chore: New authentication workflow (#4481)
* chore: New authentication workflow

* chore: resolved build erros and updated imports in auth

* chore: code optimisation for query param util

* chore: added client for auth forms
2024-05-16 17:17:04 +05:30

37 lines
1.0 KiB
TypeScript

// helpers
import { API_BASE_URL } from "@/helpers/common.helper";
// services
import { APIService } from "@/services/api.service";
// types
import { ICsrfTokenData, IEmailCheckData, IEmailCheckResponse } from "@/types/auth";
export class AuthService extends APIService {
constructor() {
super(API_BASE_URL);
}
async requestCSRFToken(): Promise<ICsrfTokenData> {
return this.get("/auth/get-csrf-token/")
.then((response) => response.data)
.catch((error) => {
throw error;
});
}
async emailCheck(data: IEmailCheckData): Promise<IEmailCheckResponse> {
return this.post("/auth/spaces/email-check/", data, { headers: {} })
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async generateUniqueCode(data: { email: string }): Promise<void> {
return this.post("/auth/spaces/magic-generate/", data, { headers: {} })
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
}