Skip to content

Commit

Permalink
creating seperate dashboard for user and admin
Browse files Browse the repository at this point in the history
  • Loading branch information
pramit-marattha committed Jan 13, 2021
1 parent af470c6 commit a1416c7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/components/authentication/LoginAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ const LoginAuth = () => {
// user information to localstorage
// authenticate the user
authenticate(data,()=>{
Router.push(`/`)
if(isAuthenticated() && isAuthenticated().role === 1){
Router.push(`/admin`)
} else {
Router.push(`/user`)
}
})

}
Expand Down
13 changes: 13 additions & 0 deletions client/pages/adminDashboard/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Layout from "../../components/Layout";
import Link from "next/link";


const AdminIndex =() =>{
return(
<Layout>
<h2>Admin Dashboard</h2>
</Layout>
)
}

export default AdminIndex;
13 changes: 13 additions & 0 deletions client/pages/userDashboard/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Layout from "../../components/Layout";
import Link from "next/link";


const UserIndex =() =>{
return(
<Layout>
<h2>User Dashboard</h2>
</Layout>
)
}

export default UserIndex;

0 comments on commit a1416c7

Please sign in to comment.