@insforge/nextjs 0.6.8 → 0.6.9
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.
- package/dist/api.d.mts +50 -0
- package/dist/api.d.ts +50 -0
- package/dist/index.d.mts +250 -0
- package/dist/index.d.ts +250 -0
- package/dist/index.js +22 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -18
- package/dist/index.mjs.map +1 -1
- package/dist/middleware.d.mts +20 -0
- package/dist/middleware.d.ts +20 -0
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -48,7 +48,7 @@ function InsforgeProvider({
|
|
|
48
48
|
const [user, setUser] = useState(null);
|
|
49
49
|
const [session, setSession] = useState(null);
|
|
50
50
|
const [isLoaded, setIsLoaded] = useState(false);
|
|
51
|
-
const refreshIntervalRef = useRef();
|
|
51
|
+
const refreshIntervalRef = useRef(null);
|
|
52
52
|
const [insforge] = useState(() => createClient({ baseUrl }));
|
|
53
53
|
const loadAuthState = useCallback(async () => {
|
|
54
54
|
try {
|
|
@@ -302,7 +302,6 @@ function useSession() {
|
|
|
302
302
|
|
|
303
303
|
// src/hooks/useOAuthProviders.ts
|
|
304
304
|
import { useState as useState2, useEffect as useEffect2 } from "react";
|
|
305
|
-
import { createClient as createClient2 } from "@insforge/sdk";
|
|
306
305
|
function useOAuthProviders() {
|
|
307
306
|
const { baseUrl } = useInsforge();
|
|
308
307
|
const [providers, setProviders] = useState2([]);
|
|
@@ -311,20 +310,25 @@ function useOAuthProviders() {
|
|
|
311
310
|
let mounted = true;
|
|
312
311
|
async function fetchProviders() {
|
|
313
312
|
try {
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
313
|
+
const response = await fetch(`${baseUrl}/api/auth/oauth/providers`);
|
|
314
|
+
if (!response.ok) {
|
|
315
|
+
if (mounted) {
|
|
316
|
+
setProviders([]);
|
|
317
|
+
setIsLoaded(true);
|
|
318
|
+
}
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const result = await response.json();
|
|
322
|
+
if (mounted) {
|
|
323
|
+
if (result?.data && Array.isArray(result.data)) {
|
|
324
|
+
setProviders(result.data);
|
|
325
|
+
} else {
|
|
326
|
+
setProviders([]);
|
|
327
|
+
}
|
|
328
|
+
setIsLoaded(true);
|
|
324
329
|
}
|
|
325
|
-
setIsLoaded(true);
|
|
326
330
|
} catch (error) {
|
|
327
|
-
console.warn("[useOAuthProviders]
|
|
331
|
+
console.warn("[useOAuthProviders] Failed to fetch OAuth providers:", error);
|
|
328
332
|
if (mounted) {
|
|
329
333
|
setProviders([]);
|
|
330
334
|
setIsLoaded(true);
|
|
@@ -341,7 +345,7 @@ function useOAuthProviders() {
|
|
|
341
345
|
|
|
342
346
|
// src/components/SignIn.tsx
|
|
343
347
|
import { useState as useState4 } from "react";
|
|
344
|
-
import { createClient as
|
|
348
|
+
import { createClient as createClient2 } from "@insforge/sdk";
|
|
345
349
|
|
|
346
350
|
// src/components/auth/AuthBranding.tsx
|
|
347
351
|
import Link from "next/link";
|
|
@@ -937,7 +941,7 @@ function SignIn({
|
|
|
937
941
|
const [error, setError] = useState4("");
|
|
938
942
|
const [loading, setLoading] = useState4(false);
|
|
939
943
|
const [oauthLoading, setOauthLoading] = useState4(null);
|
|
940
|
-
const insforge = useState4(() =>
|
|
944
|
+
const insforge = useState4(() => createClient2({ baseUrl }))[0];
|
|
941
945
|
async function handleSubmit(e) {
|
|
942
946
|
e.preventDefault();
|
|
943
947
|
setLoading(true);
|
|
@@ -1031,7 +1035,7 @@ function SignIn({
|
|
|
1031
1035
|
|
|
1032
1036
|
// src/components/SignUp.tsx
|
|
1033
1037
|
import { useState as useState5 } from "react";
|
|
1034
|
-
import { createClient as
|
|
1038
|
+
import { createClient as createClient3 } from "@insforge/sdk";
|
|
1035
1039
|
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1036
1040
|
function SignUp({
|
|
1037
1041
|
afterSignUpUrl = "/",
|
|
@@ -1061,7 +1065,7 @@ function SignUp({
|
|
|
1061
1065
|
const [error, setError] = useState5("");
|
|
1062
1066
|
const [loading, setLoading] = useState5(false);
|
|
1063
1067
|
const [oauthLoading, setOauthLoading] = useState5(null);
|
|
1064
|
-
const insforge = useState5(() =>
|
|
1068
|
+
const insforge = useState5(() => createClient3({ baseUrl }))[0];
|
|
1065
1069
|
async function handleCredentialsSubmit(e) {
|
|
1066
1070
|
e.preventDefault();
|
|
1067
1071
|
setLoading(true);
|