I’m currently developing a web app to manage cars. I created the login and register logic, and after I log out from my account, it goes back to my initial page, but the background color bugs and just appears as white, but after I refresh the page, it goes back to normal. Did it ever happen to anyone? (I’m currently using next.js, react, tailwind css, pocketbase and shadcn ui).
Initial page layout
import Navbardashboard from '@/components/Navbardashboard'
import React from 'react'
export default function layoutdashboard({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className="bg-[#423F3E]">
<Navbardashboard />
{children}
</body>
</html>
)
}
Logout logic
'use client';
import { deleteCookie } from 'cookies-next';
import { useRouter } from 'next/navigation';
import React from 'react'
import { Button } from "@/components/ui/button"
export function Logout() {
const router = useRouter();
const [error, setError] = React.useState('');
const onLogout = async () => {
try {
deleteCookie('pb_auth');
localStorage.clear();
router.push('/');
} catch (err) {
setError('Failed to log out');
}
};
return (
<Button variant="destructive" onClick={onLogout}>
Logout
{error && <p className='error'>{error}</p>}
</Button>
)
}
I haven’t tried anything yet, because I didn’t have the time due to college.