27 lines
764 B
TypeScript
27 lines
764 B
TypeScript
import BaseApiService from "@Front/Api/BaseApiService";
|
|
import { FrontendVariables } from "@Front/Config/VariablesFront";
|
|
|
|
export default class Auth extends BaseApiService {
|
|
private static instance: Auth;
|
|
|
|
private constructor() {
|
|
super();
|
|
}
|
|
|
|
public static getInstance(): Auth {
|
|
return (this.instance = this.instance ?? new this());
|
|
}
|
|
|
|
public async getIdnotJwt(autorizationCode: string | string[]): Promise<any> {
|
|
const variables = FrontendVariables.getInstance();
|
|
const baseBackUrl = variables.BACK_API_PROTOCOL + variables.BACK_API_HOST;
|
|
const url = new URL(`${baseBackUrl}/api/v1/idnot-user/${autorizationCode}`);
|
|
try {
|
|
return await this.postRequest<any>(url);
|
|
} catch (err) {
|
|
this.onError(err);
|
|
return Promise.reject(err);
|
|
}
|
|
}
|
|
}
|