Compare commits
2 commits
010aa2c2fc
...
6a773367d4
Author | SHA1 | Date | |
---|---|---|---|
6a773367d4 | |||
70cca596e4 |
2 changed files with 9 additions and 2 deletions
|
@ -204,10 +204,10 @@ export default async function trackLocation() {
|
|||
// Create throttled version of auth reload with lodash
|
||||
const reloadAuth = throttle(_reloadAuth, AUTH_RELOAD_THROTTLE, {
|
||||
leading: true,
|
||||
trailing: true,
|
||||
trailing: false, // Prevent trailing calls to avoid duplicate refreshes
|
||||
});
|
||||
|
||||
BackgroundGeolocation.onHttp((response) => {
|
||||
BackgroundGeolocation.onHttp(async (response) => {
|
||||
// Log the full response including headers if available
|
||||
locationLogger.debug("HTTP response received", {
|
||||
status: response?.status,
|
||||
|
|
|
@ -153,6 +153,7 @@ export default createAtom(({ get, merge, getActions }) => {
|
|||
}
|
||||
|
||||
if (isLoading()) {
|
||||
authLogger.info("Auth is already loading, waiting for completion");
|
||||
await loadingPromise;
|
||||
return true;
|
||||
}
|
||||
|
@ -162,9 +163,15 @@ export default createAtom(({ get, merge, getActions }) => {
|
|||
|
||||
try {
|
||||
startLoading();
|
||||
|
||||
authLogger.debug("Deleting userToken for refresh");
|
||||
await secureStore.deleteItemAsync("userToken");
|
||||
|
||||
await init();
|
||||
return true;
|
||||
} catch (error) {
|
||||
authLogger.error("Auth reload failed", { error: error.message });
|
||||
throw error;
|
||||
} finally {
|
||||
// Clear reloading state even if there was an error
|
||||
merge({ isReloading: false });
|
||||
|
|
Loading…
Add table
Reference in a new issue