CoastalCommitsPastes/client/components/admin/index.tsx

35 lines
741 B
TypeScript
Raw Permalink Normal View History

2022-04-13 15:37:15 -04:00
import { Text, Spacer } from "@geist-ui/core"
2022-04-09 20:48:19 -04:00
import Cookies from "js-cookie"
import styles from "./admin.module.css"
import PostTable from "./post-table"
import UserTable from "./user-table"
export const adminFetcher = async (
url: string,
options?: {
method?: string
body?: any
}
) =>
fetch("/server-api/admin" + url, {
method: options?.method || "GET",
2022-04-09 20:48:19 -04:00
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("drift-token")}`
},
body: options?.body && JSON.stringify(options.body)
})
const Admin = () => {
2022-04-09 20:48:19 -04:00
return (
<div className={styles.adminWrapper}>
<Text h2>Administration</Text>
<UserTable />
2022-04-09 20:48:19 -04:00
<Spacer height={1} />
<PostTable />
2022-04-09 20:48:19 -04:00
</div>
)
}
2022-04-09 20:48:19 -04:00
export default Admin