a lil frontend work (as a treat)

This commit is contained in:
Sam 2023-03-23 09:30:23 +01:00
parent 9fe6529c1b
commit 77a93fd148
No known key found for this signature in database
GPG Key ID: B4EF20DDE721CAA1
6 changed files with 36 additions and 0 deletions

View File

@ -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)
})

View File

@ -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;

View File

@ -0,0 +1 @@
<slot />

View File

@ -0,0 +1 @@
export const ssr = false;

View File

@ -0,0 +1,5 @@
<script lang="ts">
import type { PageData } from "./$types";
export let data: PageData;
</script>

View 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[];
}