fix login
Browse files- frontend/src/app/page.tsx +5 -14
frontend/src/app/page.tsx
CHANGED
|
@@ -187,29 +187,20 @@ export default function Home() {
|
|
| 187 |
return;
|
| 188 |
}
|
| 189 |
|
| 190 |
-
//
|
| 191 |
-
if (!isAuthenticated) {
|
| 192 |
-
alert('Please log in to deploy your app. Click the "Sign in with Hugging Face" button in the header.');
|
| 193 |
-
return;
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
// Ensure username is loaded
|
| 197 |
let currentUsername = username;
|
| 198 |
if (!currentUsername) {
|
| 199 |
-
console.
|
| 200 |
try {
|
| 201 |
const authStatus = await apiClient.getAuthStatus();
|
| 202 |
if (authStatus.username) {
|
| 203 |
currentUsername = authStatus.username;
|
| 204 |
setUsername(authStatus.username);
|
| 205 |
-
|
| 206 |
-
alert('Could not get username. Please try logging out and back in.');
|
| 207 |
-
return;
|
| 208 |
}
|
| 209 |
} catch (e) {
|
| 210 |
-
console.error('[Deploy]
|
| 211 |
-
|
| 212 |
-
return;
|
| 213 |
}
|
| 214 |
}
|
| 215 |
|
|
|
|
| 187 |
return;
|
| 188 |
}
|
| 189 |
|
| 190 |
+
// Get current username (fetch if not loaded)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
let currentUsername = username;
|
| 192 |
if (!currentUsername) {
|
| 193 |
+
console.log('[Deploy] Username not in state, fetching from auth...');
|
| 194 |
try {
|
| 195 |
const authStatus = await apiClient.getAuthStatus();
|
| 196 |
if (authStatus.username) {
|
| 197 |
currentUsername = authStatus.username;
|
| 198 |
setUsername(authStatus.username);
|
| 199 |
+
console.log('[Deploy] Fetched username:', currentUsername);
|
|
|
|
|
|
|
| 200 |
}
|
| 201 |
} catch (e) {
|
| 202 |
+
console.error('[Deploy] Could not get username:', e);
|
| 203 |
+
// Don't fail - let backend handle auth
|
|
|
|
| 204 |
}
|
| 205 |
}
|
| 206 |
|