Show orange upload button when Strava/Garmin auth fails
GET /api/me/sync-status reads _strava_sync_status.json and _garmin_sync_status.json for the logged-in user. On page load the nav script checks this endpoint and, if either service has status=auth_error, turns the upload arrow orange with a tooltip naming the disconnected service(s).
This commit is contained in:
@@ -663,6 +663,25 @@ try {
|
||||
if (wikiElM) wikiElM.style.display = '';
|
||||
}
|
||||
|
||||
// Sync error: turn upload button orange if Strava or Garmin auth failed
|
||||
try {
|
||||
const sr = await fetch('/api/me/sync-status', { credentials: 'include' });
|
||||
if (sr.ok) {
|
||||
const ss = await sr.json();
|
||||
const errServices = [
|
||||
ss.strava?.status === 'auth_error' ? 'Strava' : null,
|
||||
ss.garmin?.status === 'auth_error' ? 'Garmin' : null,
|
||||
].filter(Boolean);
|
||||
if (errServices.length > 0) {
|
||||
const btn = document.getElementById('upload-btn');
|
||||
if (btn) {
|
||||
btn.style.color = '#f97316';
|
||||
btn.title = `${errServices.join(' & ')} connection lost — open to reconnect`;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
// Admin: show admin link and poll for active jobs
|
||||
if (user.is_admin) {
|
||||
const adminLink = document.getElementById('nav-admin');
|
||||
|
||||
Reference in New Issue
Block a user