@dubsdotapp/expo 0.2.56 → 0.2.57
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.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useAuth.ts +13 -0
package/dist/index.d.mts
CHANGED
|
@@ -883,6 +883,8 @@ interface UseAuthResult {
|
|
|
883
883
|
* Calls GET /auth/me to validate. Returns true if valid, false otherwise.
|
|
884
884
|
*/
|
|
885
885
|
restoreSession: (token: string) => Promise<boolean>;
|
|
886
|
+
/** Re-fetch user profile from the server (e.g. after avatar change) */
|
|
887
|
+
refreshUser: () => Promise<void>;
|
|
886
888
|
/** Reset to idle state, clearing errors and user */
|
|
887
889
|
reset: () => void;
|
|
888
890
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -883,6 +883,8 @@ interface UseAuthResult {
|
|
|
883
883
|
* Calls GET /auth/me to validate. Returns true if valid, false otherwise.
|
|
884
884
|
*/
|
|
885
885
|
restoreSession: (token: string) => Promise<boolean>;
|
|
886
|
+
/** Re-fetch user profile from the server (e.g. after avatar change) */
|
|
887
|
+
refreshUser: () => Promise<void>;
|
|
886
888
|
/** Reset to idle state, clearing errors and user */
|
|
887
889
|
reset: () => void;
|
|
888
890
|
}
|
package/dist/index.js
CHANGED
|
@@ -2285,6 +2285,13 @@ function useAuth() {
|
|
|
2285
2285
|
return false;
|
|
2286
2286
|
}
|
|
2287
2287
|
}, [client]);
|
|
2288
|
+
const refreshUser = (0, import_react13.useCallback)(async () => {
|
|
2289
|
+
try {
|
|
2290
|
+
const me = await client.getMe();
|
|
2291
|
+
setUser(me);
|
|
2292
|
+
} catch {
|
|
2293
|
+
}
|
|
2294
|
+
}, [client]);
|
|
2288
2295
|
if (sharedAuth) return sharedAuth;
|
|
2289
2296
|
return {
|
|
2290
2297
|
status,
|
|
@@ -2296,6 +2303,7 @@ function useAuth() {
|
|
|
2296
2303
|
register,
|
|
2297
2304
|
logout,
|
|
2298
2305
|
restoreSession,
|
|
2306
|
+
refreshUser,
|
|
2299
2307
|
reset
|
|
2300
2308
|
};
|
|
2301
2309
|
}
|