Skip to content

Commit

Permalink
fix: lint wrapper and add mention to create database
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalk0 committed Nov 27, 2023
1 parent a34acda commit de469e9
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/components/Wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
'use client';
import { ReactNode, useEffect } from 'react';
import React, { ReactNode, useEffect } from 'react';
import { usePathname, useRouter } from 'next/navigation';
import { useDispatch, useSelector } from 'react-redux';
import { State } from '@/types';

import { autoLogin } from '@/reducers/login';
import Page from '@/app/login/page';

import Loader from './pageLoader';
import { type Action } from '@reduxjs/toolkit';

Expand Down Expand Up @@ -43,12 +41,9 @@ export default function Wrapper({

if (state.login.loading) return <Loader />;

if (!state.login.token) router.push("/login");
else if (pathname.match("/login")) router.push("/")

if (!state.login.token) router.push('/login');
else if (pathname.match('/login')) router.push('/');

// Render the layout with child components
return (
children
);
return children;
}

0 comments on commit de469e9

Please sign in to comment.