@opexa/portal-components 0.0.936 → 0.0.938

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.
@@ -33,21 +33,5 @@ export const useSessionHealthQuery = (config) => {
33
33
  });
34
34
  return ok;
35
35
  },
36
- refetchInterval: (query) => {
37
- console.log('query', query);
38
- if (query.state.error?.message === 'MEMBER_ACCOUNT_DISABLED' &&
39
- query.state.errorUpdateCount < 10) {
40
- return 5000;
41
- }
42
- return false;
43
- },
44
- retry: (failureCount, error) => {
45
- console.log('failureCount', failureCount);
46
- console.log('error', error);
47
- if (error?.message === 'MEMBER_ACCOUNT_DISABLED' && failureCount < 10) {
48
- return true;
49
- }
50
- return false;
51
- },
52
36
  });
53
37
  };
@@ -18,14 +18,14 @@ export declare const GET: (req: NextRequest, { params }: Context) => Promise<Nex
18
18
  __error?: unknown;
19
19
  } | {
20
20
  ok: true;
21
- data: Record<string, unknown>;
21
+ data: import("../types").Session;
22
22
  }> | NextResponse<{
23
23
  ok: false;
24
24
  message: string;
25
25
  __error?: unknown;
26
26
  } | {
27
27
  ok: true;
28
- data: import("../types").Session;
28
+ data: Record<string, unknown>;
29
29
  }>>;
30
30
  export declare const DELETE: (req: NextRequest, { params }: Context) => Promise<NextResponse<{
31
31
  ok: true;
@@ -69,7 +69,7 @@ export interface RefreshSessionMutation extends Omit<CreateSessionTwoFactorAuthD
69
69
  }
70
70
  export declare function refreshSession(options?: HttpRequestOptions): Promise<RefreshSessionMutation>;
71
71
  export declare function destroySession(options?: HttpRequestOptions): Promise<void>;
72
- export declare function getSessionHealth(options?: HttpRequestOptions): Promise<boolean>;
72
+ export declare function getSessionHealth(options?: HttpRequestOptions): Promise<true>;
73
73
  export interface SendVerificationCodeInput {
74
74
  strict?: boolean;
75
75
  channel: 'SMS' | 'EMAIL';
@@ -129,6 +129,12 @@ export async function destroySession(options) {
129
129
  export async function getSessionHealth(options) {
130
130
  try {
131
131
  const res = await fetch(`${AUTH_ENDPOINT}/session`, options);
132
+ if (!res.ok) {
133
+ const error = new Error();
134
+ error.message =
135
+ res.status === 403 ? 'MEMBER_ACCOUNT_DISABLED' : 'SESSION_HEALTH_ERROR';
136
+ throw error;
137
+ }
132
138
  return res.ok;
133
139
  }
134
140
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.936",
3
+ "version": "0.0.938",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",