@dubsdotapp/expo 0.2.69 → 0.2.71
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 +12 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/hooks/useAuth.ts +13 -2
package/dist/index.js
CHANGED
|
@@ -103,7 +103,7 @@ var NETWORK_CONFIG = {
|
|
|
103
103
|
cluster: "mainnet-beta"
|
|
104
104
|
},
|
|
105
105
|
devnet: {
|
|
106
|
-
baseUrl:
|
|
106
|
+
baseUrl: DEFAULT_BASE_URL,
|
|
107
107
|
rpcUrl: "https://api.devnet.solana.com",
|
|
108
108
|
cluster: "devnet"
|
|
109
109
|
}
|
|
@@ -2185,6 +2185,7 @@ async function getDeviceInfo() {
|
|
|
2185
2185
|
function useAuth() {
|
|
2186
2186
|
const sharedAuth = (0, import_react13.useContext)(AuthContext);
|
|
2187
2187
|
const { client, wallet } = useDubs();
|
|
2188
|
+
const disconnect = useDisconnect();
|
|
2188
2189
|
const [status, setStatus] = (0, import_react13.useState)("idle");
|
|
2189
2190
|
const [user, setUser] = (0, import_react13.useState)(null);
|
|
2190
2191
|
const [token, setToken] = (0, import_react13.useState)(null);
|
|
@@ -2227,10 +2228,18 @@ function useAuth() {
|
|
|
2227
2228
|
setToken(result.token);
|
|
2228
2229
|
setStatus("authenticated");
|
|
2229
2230
|
} catch (err) {
|
|
2230
|
-
|
|
2231
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2232
|
+
if (message.includes("4100") || message.includes("not been authorized")) {
|
|
2233
|
+
console.log("[useAuth] Stale Phantom session detected (4100), forcing disconnect");
|
|
2234
|
+
await disconnect?.();
|
|
2235
|
+
setStatus("idle");
|
|
2236
|
+
setError(null);
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
setError(err instanceof Error ? err : new Error(message));
|
|
2231
2240
|
setStatus("error");
|
|
2232
2241
|
}
|
|
2233
|
-
}, [client, wallet]);
|
|
2242
|
+
}, [client, wallet, disconnect]);
|
|
2234
2243
|
const register = (0, import_react13.useCallback)(async (username, referralCode, avatarUrl) => {
|
|
2235
2244
|
try {
|
|
2236
2245
|
const pending = pendingAuth.current;
|