@insforge/sdk 1.1.2-edge.2 → 1.1.2-edge.4
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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -613,23 +613,23 @@ var Auth = class {
|
|
|
613
613
|
return { data: { session: null }, error: null };
|
|
614
614
|
}
|
|
615
615
|
try {
|
|
616
|
-
const
|
|
617
|
-
if (
|
|
618
|
-
this.http.setAuthToken(
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
this.http.setAuthToken(null);
|
|
616
|
+
const session = this.tokenManager.getSession();
|
|
617
|
+
if (session) {
|
|
618
|
+
this.http.setAuthToken(session.accessToken);
|
|
619
|
+
if (Object.keys(session.user).length === 0) {
|
|
620
|
+
try {
|
|
621
|
+
const authResponse = await this.http.get(
|
|
622
|
+
"/api/auth/sessions/current",
|
|
623
|
+
{ credentials: "include" }
|
|
624
|
+
);
|
|
625
|
+
if (authResponse.user) {
|
|
626
|
+
session.user = authResponse.user;
|
|
627
|
+
this.tokenManager.setUser(authResponse.user);
|
|
628
|
+
}
|
|
629
|
+
} catch {
|
|
630
|
+
}
|
|
632
631
|
}
|
|
632
|
+
return { data: { session }, error: null };
|
|
633
633
|
}
|
|
634
634
|
if (typeof window !== "undefined") {
|
|
635
635
|
try {
|
|
@@ -661,9 +661,9 @@ var Auth = class {
|
|
|
661
661
|
if (error instanceof InsForgeError) {
|
|
662
662
|
if (error.statusCode === 404) {
|
|
663
663
|
this.tokenManager.setStorageMode();
|
|
664
|
-
const
|
|
665
|
-
if (
|
|
666
|
-
return { data: { session }, error: null };
|
|
664
|
+
const session2 = this.tokenManager.getSession();
|
|
665
|
+
if (session2) {
|
|
666
|
+
return { data: { session: session2 }, error: null };
|
|
667
667
|
}
|
|
668
668
|
return { data: { session: null }, error: null };
|
|
669
669
|
}
|
|
@@ -1843,7 +1843,7 @@ var InsForgeClient = class {
|
|
|
1843
1843
|
this.http.setAuthToken(config.edgeFunctionToken);
|
|
1844
1844
|
this.tokenManager.saveSession({
|
|
1845
1845
|
accessToken: config.edgeFunctionToken,
|
|
1846
|
-
user:
|
|
1846
|
+
user: {}
|
|
1847
1847
|
});
|
|
1848
1848
|
}
|
|
1849
1849
|
const existingSession = this.tokenManager.getSession();
|