Sync Mode6Test frontend improvements: pinch zoom 500% max, no flicker/flip, deferred rendering
This commit is contained in:
@@ -235,24 +235,24 @@
|
||||
|
||||
<script>
|
||||
(async function() {
|
||||
const { pb, authHeaders, getDisplayName, getEmail } = window.Auth;
|
||||
const { pb, authHeaders, getDisplayName, getEmail, ensureAuth, getGraphToken: getGraphTokenFromBackend } = window.Auth;
|
||||
|
||||
// ========================================
|
||||
// TOKEN VALIDATION - CHECK BOTH AT STARTUP
|
||||
// ========================================
|
||||
const GRAPH_TOKEN_KEY = 'graphAccessToken';
|
||||
|
||||
// Check 1: PocketBase session must be valid
|
||||
if (!pb?.authStore?.isValid) {
|
||||
console.log('[Init] No PocketBase session - redirecting to signin');
|
||||
window.location.href = 'signin.html';
|
||||
// Use shared auth helper to validate PB and refresh tokens if possible
|
||||
const isAuthed = await ensureAuth();
|
||||
if (!isAuthed) {
|
||||
// ensureAuth will redirect to signin when needed
|
||||
return;
|
||||
}
|
||||
|
||||
// Check 2: Graph token must exist in localStorage
|
||||
let APP_GRAPH_TOKEN = localStorage.getItem(GRAPH_TOKEN_KEY) || '';
|
||||
// Try to get Graph token (localStorage first, then backend refresh)
|
||||
let APP_GRAPH_TOKEN = await getGraphTokenFromBackend();
|
||||
if (!APP_GRAPH_TOKEN) {
|
||||
console.log('[Init] No Graph token - redirecting to signin');
|
||||
console.log('[Init] No Graph token after backend refresh - redirecting to signin');
|
||||
window.location.href = 'signin.html?reauth=1';
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user