@insforge/sdk 1.1.3-test.1 → 1.1.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/LICENSE +201 -201
- package/README.md +259 -259
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +68 -68
package/dist/index.mjs
CHANGED
|
@@ -642,6 +642,19 @@ var Auth = class {
|
|
|
642
642
|
const session = this.tokenManager.getSession();
|
|
643
643
|
if (session) {
|
|
644
644
|
this.http.setAuthToken(session.accessToken);
|
|
645
|
+
if (!session.user || Object.keys(session.user).length === 0) {
|
|
646
|
+
try {
|
|
647
|
+
const authResponse = await this.http.get(
|
|
648
|
+
"/api/auth/sessions/current",
|
|
649
|
+
{ credentials: "include" }
|
|
650
|
+
);
|
|
651
|
+
if (authResponse.user) {
|
|
652
|
+
session.user = authResponse.user;
|
|
653
|
+
this.tokenManager.setUser(authResponse.user);
|
|
654
|
+
}
|
|
655
|
+
} catch {
|
|
656
|
+
}
|
|
657
|
+
}
|
|
645
658
|
return { data: { user: session.user }, error: null };
|
|
646
659
|
}
|
|
647
660
|
if (typeof window !== "undefined") {
|