-
Notifications
You must be signed in to change notification settings - Fork 102
cache login local storage #6839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like some of these changes (e.g. NavBar) are already in the main
?
please rebase and resolve conflicts
} | ||
|
||
// Clear expired or mismatched cache | ||
localStorage.removeItem(PERMISSION_CACHE_KEY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: code duplication
} | ||
}; | ||
|
||
const clearCachedPermissionState = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused?
let newState: "sufficient" | "insufficient"; | ||
if (response.status === 403) { | ||
newState = "insufficient"; | ||
} else if (!response.ok) { | ||
// For 500 errors or other issues, also show insufficient permissions | ||
newState = "insufficient"; | ||
} else { | ||
newState = "sufficient"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let newState: "sufficient" | "insufficient"; | |
if (response.status === 403) { | |
newState = "insufficient"; | |
} else if (!response.ok) { | |
// For 500 errors or other issues, also show insufficient permissions | |
newState = "insufficient"; | |
} else { | |
newState = "sufficient"; | |
} | |
const newState = response.status === 403 || !response.ok ? "insufficient" : "sufficient"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably could be simplified further to just checking response.ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stamping to unblock, but I think some more cleanup is warranted
• auth improvements:
– localStorage-backed 30-day cache for the “does the current user have write access to pytorch/pytorch?” check.
– new /api/torchagent-check-permissions endpoint and client-side logic to call it.
– better unauthenticated / insufficient-permission screens and a “Try again” flow.