@tagsamurai/fats-api-services 2.0.0-alpha.14 → 2.0.0-alpha.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -189,12 +189,11 @@ const API$1 = createAxiosInstance({
189
189
  prefix: "/v2/iam/auth"
190
190
  });
191
191
  const onRejected = (error) => {
192
- if (error.response?.status === 401 || error.response?.status === 500 || error.message === "jwt malformed") {
192
+ if (error.response?.status === 401 || error.response?.status === 500 || error.response?.data?.message === "jwt malformed") {
193
193
  window.onblur = void 0;
194
194
  window.onfocus = void 0;
195
195
  window.sessionExpired = true;
196
- window.dispatchEvent(new CustomEvent("user:expired"));
197
- return Promise.reject(error);
196
+ return window.dispatchEvent(new CustomEvent("user:expired"));
198
197
  }
199
198
  return Promise.reject(error);
200
199
  };
@@ -213,8 +212,8 @@ const AuthServices = {
213
212
  // Allow users without access to Global Settings to hit relogin
214
213
  });
215
214
  },
216
- requestOTP: (email) => {
217
- const body = { email };
215
+ requestOTP: (email, resendAttempt) => {
216
+ const body = { email, resendAttempt };
218
217
  return API$1.post("/request-otp", body);
219
218
  },
220
219
  requestResetPassLink: (email) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/fats-api-services",
3
- "version": "2.0.0-alpha.14",
3
+ "version": "2.0.0-alpha.16",
4
4
  "type": "module",
5
5
  "author": "Tagsamurai",
6
6
  "description": "Fixed Asset Tagsamurai API Services",
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { LoginCredentials, SetPasswordBody } from '../dto/globalAuth.dto';
3
3
  import { EmailActionResponse } from '../types/emailActionResponse.type';
4
- import { FetchDetailResponse, FetchResponse } from '../types/fetchResponse.type';
4
+ import { FetchDetailResponse } from '../types/fetchResponse.type';
5
5
  interface LoginResponse {
6
6
  _id: string;
7
7
  companyName: string;
@@ -28,13 +28,13 @@ declare const AuthServices: {
28
28
  reLogin: (body: {
29
29
  jwt: string;
30
30
  }) => Promise<AxiosResponse<LoginResponse>>;
31
- requestOTP: (email: string) => Promise<AxiosResponse<EmailActionResponse<boolean>>>;
31
+ requestOTP: (email: string, resendAttempt?: number) => Promise<AxiosResponse<EmailActionResponse<boolean>>>;
32
32
  requestResetPassLink: (email: string) => Promise<AxiosResponse<EmailActionResponse<boolean>>>;
33
- setPassword: (body: SetPasswordBody) => Promise<AxiosResponse<FetchResponse>>;
33
+ setPassword: (body: SetPasswordBody) => Promise<AxiosResponse>;
34
34
  verifyToken: (token: string) => Promise<AxiosResponse<FetchDetailResponse<boolean>>>;
35
- confirmEmailChange: (token: string) => Promise<AxiosResponse<FetchResponse>>;
36
- cancelEmailChange: (_id: string) => Promise<AxiosResponse<FetchResponse>>;
37
- postLogout: () => Promise<AxiosResponse<FetchResponse>>;
35
+ confirmEmailChange: (token: string) => Promise<AxiosResponse>;
36
+ cancelEmailChange: (_id: string) => Promise<AxiosResponse>;
37
+ postLogout: () => Promise<AxiosResponse>;
38
38
  };
39
39
  declare global {
40
40
  interface Window {