Replaced dummy data in commands page to API data
This commit is contained in:
parent
2fa79da9d7
commit
f38696e60e
1 changed files with 9 additions and 1 deletions
|
@ -13,6 +13,7 @@ import {
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import { useSession } from 'next-auth/client'
|
import { useSession } from 'next-auth/client'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { FaBullseye } from 'react-icons/fa';
|
||||||
|
|
||||||
|
|
||||||
function Controller({ initialState }) {
|
function Controller({ initialState }) {
|
||||||
|
@ -29,6 +30,13 @@ function Controller({ initialState }) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function processOnline(status) {
|
||||||
|
console.log(status)
|
||||||
|
if (status == 'online') { return true }
|
||||||
|
if (status == 'offline') { return false }
|
||||||
|
if (status == 'maintenance') { return false }
|
||||||
|
}
|
||||||
|
|
||||||
function Commands() {
|
function Commands() {
|
||||||
const [session, loading] = useSession()
|
const [session, loading] = useSession()
|
||||||
|
|
||||||
|
@ -70,7 +78,7 @@ function Commands() {
|
||||||
<Tr key={commandIdx}>
|
<Tr key={commandIdx}>
|
||||||
<Td>{command.name}</Td>
|
<Td>{command.name}</Td>
|
||||||
<Td>
|
<Td>
|
||||||
<Controller initialState={command.online} />
|
<Controller initialState={processOnline(command.status)} />
|
||||||
</Td>
|
</Td>
|
||||||
</Tr>
|
</Tr>
|
||||||
))}
|
))}
|
||||||
|
|
Loading…
Reference in a new issue