Last change
on this file since 113029b was 55ed171, checked in by Nace Gjorgjievski <nace.gorgievski123@…>, 2 years ago |
Full Admin Functionality Added
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | import React, { useContext, useEffect, useState } from "react";
|
---|
2 | import Button from "react-bootstrap/Button";
|
---|
3 | import "../styles/AdminDashboard.css";
|
---|
4 | import AddProductForm from "../components/AddProductForm";
|
---|
5 | import { Store } from "../Store";
|
---|
6 | import { useNavigate, Link } from "react-router-dom";
|
---|
7 | import ListProducts from "../components/ListProducts";
|
---|
8 |
|
---|
9 | function AdminDashboardScreen() {
|
---|
10 | const navigate = useNavigate();
|
---|
11 | const { state } = useContext(Store);
|
---|
12 | const { userInfo } = state;
|
---|
13 | useEffect(() => {
|
---|
14 | if (!userInfo || !userInfo.isAdmin) {
|
---|
15 | return navigate("/");
|
---|
16 | }
|
---|
17 | }, [userInfo, navigate]);
|
---|
18 |
|
---|
19 | return (
|
---|
20 | <div id="pgContainer">
|
---|
21 | <div id="sidebarMenu">
|
---|
22 | <Link
|
---|
23 | to={"/admin/addProduct"}
|
---|
24 | style={{ textDecoration: "none", width: "100%" }}
|
---|
25 | >
|
---|
26 | <div className="dashboard-btn" to="/admin/addProduct">
|
---|
27 | Додади нов производ
|
---|
28 | </div>
|
---|
29 | </Link>
|
---|
30 | <Link
|
---|
31 | to={"/admin/products"}
|
---|
32 | style={{ textDecoration: "none", width: "100%" }}
|
---|
33 | >
|
---|
34 | <div className="dashboard-btn">Производи</div>
|
---|
35 | </Link>
|
---|
36 | <Link
|
---|
37 | to={"/admin/orders"}
|
---|
38 | style={{ textDecoration: "none", width: "100%" }}
|
---|
39 | >
|
---|
40 | <div className="dashboard-btn">Нарачки</div>
|
---|
41 | </Link>
|
---|
42 | </div>
|
---|
43 | </div>
|
---|
44 | );
|
---|
45 | }
|
---|
46 |
|
---|
47 | export default AdminDashboardScreen;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.