- Here is a custom route that was added in the Payload config. It uses the
- Default Template, so the sidebar is rendered.
-
+
+
);
};
diff --git a/apps/cms/src/admin/views/MerchSales.tsx b/apps/cms/src/admin/views/MerchSales.tsx
index a809cc2f..81d2d3f2 100644
--- a/apps/cms/src/admin/views/MerchSales.tsx
+++ b/apps/cms/src/admin/views/MerchSales.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react";
-import { Button } from 'payload/components/elements';
-import { AdminView } from 'payload/config';
+import { Button } from "payload/components/elements";
+import { AdminView } from "payload/config";
import ViewTemplate from "./ViewTemplate";
import { Column } from "payload/dist/admin/components/elements/Table/types";
import { Order } from "../../@types/Order";
@@ -11,34 +11,35 @@ import SortedColumn from "../utils/SortedColumn";
import { Table } from "payload/dist/admin/components/elements/Table";
const MerchSales: AdminView = ({ user, canAccessAdmin }) => {
-
// Get data from API
const [data, setData] = useState(null);
useEffect(() => {
OrdersApi.getOrders()
- .then(
- (res: IOrder[]) => setData(res)
- )
+ .then((res: IOrder[]) => setData(res))
.catch((error) => console.log(error));
}, []);
// Output human-readable table headers based on the attribute names from the API
function prettifyKey(str: string): string {
let res = "";
- for (const i of str.split('_')) {
- res += i.charAt(0).toUpperCase() + i.slice(1) + " "
+ for (const i of str.split("_")) {
+ res += i.charAt(0).toUpperCase() + i.slice(1) + " ";
}
return res;
}
// Do not load table until we receive the data
- if (data==null) {
- return