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"
|
2022-04-13 00:14:10 -04:00
|
|
|
import PostTable from "./post-table"
|
2022-04-20 04:49:34 -04:00
|
|
|
import ServerInfo from "./server-info"
|
2022-04-13 00:14:10 -04:00
|
|
|
import UserTable from "./user-table"
|
2022-03-29 03:11:02 -04:00
|
|
|
|
2022-04-13 00:14:10 -04:00
|
|
|
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")}`
|
2022-04-13 00:14:10 -04:00
|
|
|
},
|
|
|
|
body: options?.body && JSON.stringify(options.body)
|
|
|
|
})
|
2022-03-28 15:13:22 -04:00
|
|
|
|
|
|
|
const Admin = () => {
|
2022-04-09 20:48:19 -04:00
|
|
|
return (
|
|
|
|
<div className={styles.adminWrapper}>
|
|
|
|
<Text h2>Administration</Text>
|
2022-04-20 04:49:34 -04:00
|
|
|
<ServerInfo />
|
|
|
|
<Spacer height={1} />
|
2022-04-13 00:14:10 -04:00
|
|
|
<UserTable />
|
2022-04-09 20:48:19 -04:00
|
|
|
<Spacer height={1} />
|
2022-04-13 00:14:10 -04:00
|
|
|
<PostTable />
|
2022-04-09 20:48:19 -04:00
|
|
|
</div>
|
|
|
|
)
|
2022-03-28 15:13:22 -04:00
|
|
|
}
|
|
|
|
|
2022-04-09 20:48:19 -04:00
|
|
|
export default Admin
|