diff --git a/client/src/components/About.jsx b/client/src/components/About.jsx
index 1309ef0..7051962 100644
--- a/client/src/components/About.jsx
+++ b/client/src/components/About.jsx
@@ -1,12 +1,10 @@
import React from "react";
import MTable from "./accountTable";
-
function About() {
return (
-
Material Table Example
-
+
);
}
diff --git a/client/src/components/accountTable.jsx b/client/src/components/accountTable.jsx
index 1f72de3..6745ee4 100644
--- a/client/src/components/accountTable.jsx
+++ b/client/src/components/accountTable.jsx
@@ -1,42 +1,88 @@
-import { useState } from "react";
+import React, { Component } from "react";
+import axios from "axios"; // npm instal axios
+import { forwardRef } from "react";
import MaterialTable from "material-table";
-import { data } from "../data";
+import ArrowDownward from "@material-ui/icons/ArrowDownward";
+import ChevronLeft from "@material-ui/icons/ChevronLeft";
+import ChevronRight from "@material-ui/icons/ChevronRight";
+import Clear from "@material-ui/icons/Clear";
+import FilterList from "@material-ui/icons/FilterList";
+import FirstPage from "@material-ui/icons/FirstPage";
+import LastPage from "@material-ui/icons/LastPage";
+import Search from "@material-ui/icons/Search";
-const MTable = () => {
-// let res
-// try {
-// res = axios.get("/getUserAccounts", {
-// data: {
-// username: "Duly",
-// },
-// });
-// } catch (error) {
-// console.log(error);
-// }
- const [selectedRow, setSelectedRow] = useState(null);
- const columns = [
- { title: "UserName", field: "username" },
- { title: "Stream Name", field: "streamName" },
- { title: "Stream URL", field: "streamURL" },
- ];
- return (
-
-
- setSelectedRow(selectedRow.tableData.id)
- }
- options={{
- search: false,
- rowStyle: (rowData) => ({
- backgroundColor:
- selectedRow === rowData.tableData.id ? "#67aeae" : "#FFF",
- }),
- }}
- />
-
- );
+const tableIcons = {
+ // DetailPanel: forwardRef((props, ref) => ),
+ Filter: forwardRef((props, ref) => ),
+ FirstPage: forwardRef((props, ref) => ),
+ LastPage: forwardRef((props, ref) => ),
+ NextPage: forwardRef((props, ref) => ),
+ PreviousPage: forwardRef((props, ref) => (
+
+ )),
+ ResetSearch: forwardRef((props, ref) => ),
+ Search: forwardRef((props, ref) => ),
+ SortArrow: forwardRef((props, ref) => ),
};
-export default MTable;
+
+export default class MatDataTable extends Component {
+ constructor(props) {
+ super(props);
+ this.state = { person: [] };
+ }
+
+ componentDidMount(prevProps) {
+ const user = "Karl";
+ const url = `/getUserAccounts?userName=${user}`;
+ axios.get(url).then((results) => {
+ console.log(results);
+ console.log(results.data);
+ this.setState({ person: results.data });
+
+ var newArr = results.data.map(function (val) {
+ return {
+ username: val.username,
+ streamName: val.streamName,
+ streamURL: val.streamURL,
+ expiaryDate: val.expiaryDate
+ };
+ });
+ console.log(results.data.results);
+ this.setState(
+ {
+ tableArray: newArr, //set state of the weather5days
+ },
+ () => {
+ console.log(this.state.tableArray);
+ console.log("this.tableArray ", this.state.tableArray);
+ }
+ );
+ });
+ }
+
+ render() {
+ return (
+
+
+
+ );
+ }
+}
diff --git a/lib/getUser.js b/lib/getUser.js
index 7b18ff1..a28fa66 100644
--- a/lib/getUser.js
+++ b/lib/getUser.js
@@ -4,7 +4,8 @@ function getUserAccounts(user) {
let data = sql.query(`SELECT
userAccounts.username,
streams.streamName,
- streams.streamURL
+ streams.streamURL,
+ userAccounts.expiaryDate
FROM users
INNER JOIN userAccounts
ON users.idusers = userAccounts.userID