2022-11-10 02:11:36 -05:00
|
|
|
"use client"
|
|
|
|
|
2022-04-09 20:48:19 -04:00
|
|
|
import styles from "./admin.module.css"
|
2022-04-13 00:14:10 -04:00
|
|
|
import PostTable from "./post-table"
|
|
|
|
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
|
|
|
|
}
|
|
|
|
) =>
|
2022-11-12 04:28:06 -05:00
|
|
|
fetch("/api/admin" + url, {
|
2022-04-13 00:14:10 -04:00
|
|
|
method: options?.method || "GET",
|
2022-04-09 20:48:19 -04:00
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json",
|
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}>
|
2022-11-08 03:23:28 -05:00
|
|
|
<h2>Administration</h2>
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
display: "flex",
|
|
|
|
flexDirection: "column",
|
|
|
|
alignItems: "center",
|
|
|
|
gap: 4
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<UserTable />
|
|
|
|
<PostTable />
|
|
|
|
</div>
|
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
|