@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.cjs CHANGED
@@ -565,8 +565,8 @@ var InsforgeManager = class _InsforgeManager {
565
565
  // Called after hydration to get complete user information beyond what's in cookies
566
566
  async loadAuthState() {
567
567
  try {
568
- const { isLoggedIn } = await this.sdk.auth.restoreSession();
569
- if (!isLoggedIn) {
568
+ const { data: { session } } = await this.sdk.auth.getCurrentSession();
569
+ if (!session) {
570
570
  this.user = null;
571
571
  if (this.config.onAuthChange) {
572
572
  this.config.onAuthChange(null);
@@ -599,7 +599,8 @@ var InsforgeManager = class _InsforgeManager {
599
599
  }
600
600
  this.isLoaded = true;
601
601
  this.notifyListeners();
602
- return { success: false, error: userResult.error?.message || "failed_to_get_user" };
602
+ const errorMessage = userResult.error?.message ?? "failed_to_get_user";
603
+ return { success: false, error: errorMessage };
603
604
  }
604
605
  } catch (error) {
605
606
  this.user = null;