fix navbar and guest user checks

previously guest users would cause a response 500 if a private album existed, meaning they couldn't see any albums
they also couldn't load media in any album due to requiring an access token
This commit is contained in:
wisplite
2025-11-23 02:58:03 -06:00
parent 8759783ebb
commit c7d478271d
6 changed files with 60 additions and 7 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ export default function NavBar({ path }) {
const [open, setOpen] = useState(false);
const { user, logout } = useAccount();
return (
<div className="flex flex-row items-center justify-between h-1/10 w-full px-6 py-2 border-b border-[#2B2B2B]">
<div className="flex flex-row items-center justify-between h-[10vh] w-full px-6 py-2 border-b border-[#2B2B2B] shrink-0">
<div className="flex flex-row items-center justify-start gap-2">
{path.map((item, index) => (
<div className="flex flex-row items-center justify-start gap-2 red-hat-mono">
+4 -1
View File
@@ -59,8 +59,11 @@ export const AccountProvider = ({ children }) => {
if (!accessToken && localStorage.getItem('accessToken')) {
setAccessToken(localStorage.getItem('accessToken'))
return localStorage.getItem('accessToken')
} else if (accessToken) {
return accessToken
} else {
return "guest"
}
return accessToken
}
return <AccountContext.Provider value={{ getAccessToken, logout, login, fetchUserData, user }}>{children}</AccountContext.Provider>
+1 -1
View File
@@ -51,7 +51,7 @@ export default function Gallery() {
}, [currentAlbumID])
return (
<div className="flex flex-col items-center justify-start h-full w-full bg-[#141414]">
<div className="flex flex-col items-center justify-start min-h-screen w-full bg-[#141414]">
<NavBar path={pathList} />
<AlbumList currentAlbumName={currentAlbumID} />
<MediaList albumId={currentAlbumID} albumName={currentAlbumName} />