@insforge/react 1.0.2-dev.17 → 1.0.2-dev.19

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,10 @@ 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 {
548
+ data: { session }
549
+ } = await this.sdk.auth.getCurrentSession();
550
+ if (!session) {
549
551
  this.user = null;
550
552
  if (this.config.onAuthChange) {
551
553
  this.config.onAuthChange(null);
@@ -578,7 +580,8 @@ var InsforgeManager = class _InsforgeManager {
578
580
  }
579
581
  this.isLoaded = true;
580
582
  this.notifyListeners();
581
- return { success: false, error: userResult.error?.message || "failed_to_get_user" };
583
+ const errorMessage = userResult.error?.message ?? "failed_to_get_user";
584
+ return { success: false, error: errorMessage };
582
585
  }
583
586
  } catch (error) {
584
587
  this.user = null;
@@ -638,7 +641,6 @@ var InsforgeManager = class _InsforgeManager {
638
641
  email,
639
642
  password
640
643
  });
641
- console.log("sdkResult", sdkResult);
642
644
  if (sdkResult.data) {
643
645
  await this.handleAuthSuccess(
644
646
  sdkResult.data.accessToken || "",
@@ -4145,7 +4147,6 @@ function SignIn({ onError, ...uiProps }) {
4145
4147
  setError("");
4146
4148
  try {
4147
4149
  const result = await signIn(email, password);
4148
- console.log("result", result);
4149
4150
  if ("error" in result) {
4150
4151
  if (result.statusCode === 403) {
4151
4152
  setStep("awaiting-verification");