- You can use demo@oktopus.io and password Password123!
+ Don't have an account? ask one for us at
+ Github
+
diff --git a/frontend/src/pages/devices.js b/frontend/src/pages/devices.js
index 39509e6..43eefa3 100644
--- a/frontend/src/pages/devices.js
+++ b/frontend/src/pages/devices.js
@@ -1,29 +1,39 @@
import React, { useState, useEffect } from 'react';
import Head from 'next/head';
-import { subDays, subHours } from 'date-fns';
import { Box, Container, Unstable_Grid2 as Grid } from '@mui/material';
import { Layout as DashboardLayout } from 'src/layouts/dashboard/layout';
-import { OverviewBudget } from 'src/sections/overview/overview-budget';
import { OverviewLatestOrders } from 'src/sections/overview/overview-latest-orders';
-import { OverviewLatestProducts } from 'src/sections/overview/overview-latest-products';
-import { OverviewSales } from 'src/sections/overview/overview-sales';
-import { OverviewTasksProgress } from 'src/sections/overview/overview-tasks-progress';
-import { OverviewTotalCustomers } from 'src/sections/overview/overview-total-customers';
-import { OverviewTotalProfit } from 'src/sections/overview/overview-total-profit';
-import { OverviewTraffic } from 'src/sections/overview/overview-traffic';
-
-
+import { useAuth } from 'src/hooks/use-auth';
const Page = () => {
+ const auth = useAuth();
const [devices, setDevices] = useState([]);
useEffect(() => {
- fetch('https://d9962fd9-2464-4a30-9a86-a15a04b57ad0.mock.pstmn.io/device')
+
+ if (auth.user.token) {
+ console.log("auth.user.token =", auth.user.token)
+ }else{
+ auth.user.token = localStorage.getItem("token")
+ }
+
+ var myHeaders = new Headers();
+ myHeaders.append("Content-Type", "application/json");
+ myHeaders.append("Authorization", auth.user.token);
+
+ var requestOptions = {
+ method: 'GET',
+ headers: myHeaders,
+ redirect: 'follow'
+ }
+
+ fetch(process.env.NEXT_PUBLIC_REST_ENPOINT+'/device', requestOptions)
.then(response => response.json())
.then(json => setDevices(json))
.catch(error => console.error('Error:', error));
}, []);
- return (
+
+ return (devices &&
<>