firmware query

This commit is contained in:
Irtiza-h30
2020-07-16 12:28:03 -04:00
parent 8a37ae767a
commit 31a61fe804
2 changed files with 31 additions and 2 deletions

View File

@@ -1,8 +1,23 @@
import React from 'react';
import { Firmware as FirmwarePage } from '@tip-wlan/wlan-cloud-ui-library';
import { useQuery } from '@apollo/react-hooks';
import { Alert } from 'antd';
import { GET_ALL_FIRMWARE } from 'graphql/queries';
import { Firmware as FirmwarePage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
const Firmware = () => {
return <FirmwarePage />;
const { data, error, loading } = useQuery(GET_ALL_FIRMWARE);
if (error) {
return (
<Alert message="Error" description="Failed to load Firmware data." type="error" showIcon />
);
}
if (loading) {
return <Loading />;
}
return <FirmwarePage firmwareData={data && data.getAllFirmware} />;
};
export default Firmware;

View File

@@ -223,3 +223,17 @@ export const GET_ALL_STATUS = gql`
}
}
`;
export const GET_ALL_FIRMWARE = gql`
query GetAllFirmware {
getAllFirmware {
id
modelId
versionName
description
filename
commit
releaseDate
}
}
`;