forked from mirrors/pronouns.cc
a lil frontend work (as a treat)
This commit is contained in:
parent
9fe6529c1b
commit
77a93fd148
6 changed files with 36 additions and 0 deletions
|
@ -20,6 +20,7 @@ func Mount(srv *server.Server, r chi.Router) {
|
|||
r.Get("/reports/by-user/{id}", server.WrapHandler(s.getReportsByUser))
|
||||
r.Get("/reports/by-reporter/{id}", server.WrapHandler(s.getReportsByReporter))
|
||||
|
||||
r.Get("/reports/{id}", nil)
|
||||
r.Patch("/reports/{id}", nil)
|
||||
})
|
||||
|
||||
|
|
|
@ -81,6 +81,19 @@ export interface Invite {
|
|||
used: boolean;
|
||||
}
|
||||
|
||||
export interface Report {
|
||||
id: string;
|
||||
user_id: string;
|
||||
member_id: string | null;
|
||||
reason: string;
|
||||
reporter_id: string;
|
||||
|
||||
created_at: string;
|
||||
resolved_at: string | null;
|
||||
admin_id: string | null;
|
||||
admin_comment: string | null;
|
||||
}
|
||||
|
||||
export interface APIError {
|
||||
code: ErrorCode;
|
||||
message?: string;
|
||||
|
|
1
frontend/src/routes/reports/+layout.svelte
Normal file
1
frontend/src/routes/reports/+layout.svelte
Normal file
|
@ -0,0 +1 @@
|
|||
<slot />
|
1
frontend/src/routes/reports/+layout.ts
Normal file
1
frontend/src/routes/reports/+layout.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export const ssr = false;
|
5
frontend/src/routes/reports/+page.svelte
Normal file
5
frontend/src/routes/reports/+page.svelte
Normal file
|
@ -0,0 +1,5 @@
|
|||
<script lang="ts">
|
||||
import type { PageData } from "./$types";
|
||||
|
||||
export let data: PageData;
|
||||
</script>
|
15
frontend/src/routes/reports/+page.ts
Normal file
15
frontend/src/routes/reports/+page.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import type { Report } from "$lib/api/entities";
|
||||
import { apiFetchClient } from "$lib/api/fetch";
|
||||
|
||||
export const load = async () => {
|
||||
const reports = await apiFetchClient<Report[]>("/admin/reports");
|
||||
return { page: 0, isClosed: false, userId: null, reporterId: null, reports } as PageLoadData;
|
||||
};
|
||||
|
||||
interface PageLoadData {
|
||||
page: number;
|
||||
isClosed: boolean;
|
||||
userId: string | null;
|
||||
reporterId: string | null;
|
||||
reports: Report[];
|
||||
}
|
Loading…
Reference in a new issue