@insforge/react 1.0.2-dev.16 → 1.0.2-dev.18

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.js CHANGED
@@ -544,8 +544,8 @@ var InsforgeManager = class _InsforgeManager {
544
544
  // Called after hydration to get complete user information beyond what's in cookies
545
545
  async loadAuthState() {
546
546
  try {
547
- const { isLoggedIn } = await this.sdk.auth.restoreSession();
548
- if (!isLoggedIn) {
547
+ const { data: { session } } = await this.sdk.auth.getCurrentSession();
548
+ if (!session) {
549
549
  this.user = null;
550
550
  if (this.config.onAuthChange) {
551
551
  this.config.onAuthChange(null);
@@ -578,7 +578,8 @@ var InsforgeManager = class _InsforgeManager {
578
578
  }
579
579
  this.isLoaded = true;
580
580
  this.notifyListeners();
581
- return { success: false, error: userResult.error?.message || "failed_to_get_user" };
581
+ const errorMessage = userResult.error?.message ?? "failed_to_get_user";
582
+ return { success: false, error: errorMessage };
582
583
  }
583
584
  } catch (error) {
584
585
  this.user = null;