@insforge/react 0.5.2 → 0.5.3

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.cts CHANGED
@@ -28,7 +28,9 @@ interface InsforgeContextValue {
28
28
  errorCode?: string;
29
29
  }>;
30
30
  signOut: () => Promise<void>;
31
- updateUser: (data: Partial<InsforgeUser>) => Promise<void>;
31
+ updateUser: (data: Partial<InsforgeUser>) => Promise<{
32
+ error: string;
33
+ } | null>;
32
34
  reloadAuth: () => Promise<{
33
35
  success: boolean;
34
36
  error?: string;
package/dist/index.d.ts CHANGED
@@ -28,7 +28,9 @@ interface InsforgeContextValue {
28
28
  errorCode?: string;
29
29
  }>;
30
30
  signOut: () => Promise<void>;
31
- updateUser: (data: Partial<InsforgeUser>) => Promise<void>;
31
+ updateUser: (data: Partial<InsforgeUser>) => Promise<{
32
+ error: string;
33
+ } | null>;
32
34
  reloadAuth: () => Promise<{
33
35
  success: boolean;
34
36
  error?: string;
package/dist/index.js CHANGED
@@ -293,7 +293,7 @@ function InsforgeProvider({
293
293
  const updateUser = useCallback(
294
294
  async (data) => {
295
295
  if (!user) {
296
- throw new Error("No user signed in");
296
+ return { error: "No user signed in" };
297
297
  }
298
298
  const profileUpdate = {
299
299
  nickname: data.name,
@@ -315,6 +315,9 @@ function InsforgeProvider({
315
315
  onAuthChange(updatedUser);
316
316
  }
317
317
  }
318
+ return null;
319
+ } else {
320
+ return { error: result.error?.message || "Failed to update user" };
318
321
  }
319
322
  },
320
323
  [user, onAuthChange, insforge]
@@ -425,8 +428,7 @@ function useInsforge() {
425
428
  signUp: async () => ({ error: "SSR mode" }),
426
429
  signOut: async () => {
427
430
  },
428
- updateUser: async () => {
429
- },
431
+ updateUser: async () => ({ error: "SSR mode" }),
430
432
  reloadAuth: async () => ({ success: false, error: "SSR mode" }),
431
433
  sendVerificationEmail: async () => null,
432
434
  sendResetPasswordEmail: async () => null,