forked from pingwu/maca
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchanges_part2.diff
More file actions
43 lines (40 loc) · 1.5 KB
/
changes_part2.diff
File metadata and controls
43 lines (40 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
*** frontend/src/services/AuthContext.tsx.orig 2025-02-15
--- frontend/src/services/AuthContext.tsx 2025-02-15
***************
*** 33,63 ****
const response = await fetch(`${API_BASE_URL}/auth/status`, {
credentials: 'include',
});
console.log('DEBUG: Auth response status:', response.status);
console.log('DEBUG: Auth response ok:', response.ok);
if (response.ok) {
const data = await response.json();
console.log('DEBUG: Auth response data:', data);
setIsAuthenticated(data.authenticated);
} else {
console.log('DEBUG: Auth response not ok, setting to false');
setIsAuthenticated(false);
}
} catch (error) {
console.error('Error checking authentication status:', error);
setIsAuthenticated(false);
}
+ setIsLoading(false);
};
***************
*** 66,72 ****
// Check if we just returned from OAuth (detect by checking if this is root and no auth yet)
const checkOAuthReturn = () => {
const urlParams = new URLSearchParams(window.location.search);
const path = window.location.pathname;
// If we're on the root path and it's been more than 100ms since load, re-check auth
--- 74,81 ----
// If we're on the root path and it's been more than 100ms since load, re-check auth
if (path === '/' && !isAuthenticated) {
setTimeout(() => {
checkAuth();
}, 100);
}
};
---
*** End Patch