Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

267
Views
Nextjs css not working properly after router.push()

It's my first project in nextJS so please don't blame me if it's super basic stuff. The problem is if person go to the home page it will redirect him to login page if his not authenticated. And login page is inheriting background picture from index page which isn't supposed to. And after logging in and going back to index page. Index page's background picture is half cut. Can't insert pictures because of my reputation :<

Here is how I'm adding background image to home page

<body style={{
    backgroundImage: "url('https://images4.alphacoders.com/480/thumb-1920-48076.jpg')"
}}>`

It's how I'm routing

useEffect(() => {
if (loading) {
return;
}
if (user){ 
console.log('logged in');
fetchData(user.uid)}
else{
router.push("/login");}}, [user, loading]);```

Thank you.

I have no idea how to solve this. I added 2 different body css code to these pages.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!