Compare commits

..

2 Commits

Author SHA1 Message Date
35c0003159 Data/Official: Disable scrape button for official data clientside
All checks were successful
Build Formula11 Docker Image / pocketbase-docker (push) Successful in 30s
2025-06-07 20:40:59 +02:00
5a6156adb7 Skeleton: Subscribe to scraped_startinggrids collection 2025-06-07 20:40:19 +02:00
2 changed files with 13 additions and 1 deletions

View File

@ -329,6 +329,7 @@
"seasonpicks",
"substitutions",
"teams",
"scraped_startinggrids",
"scraped_raceresults",
"scraped_driverstandings",
"scraped_teamstandings",
@ -347,6 +348,7 @@
"seasonpicks",
"substitutions",
"teams",
"scraped_startinggrids",
"scraped_raceresults",
"scraped_driverstandings",
"scraped_teamstandings",

View File

@ -1,10 +1,14 @@
<script lang="ts">
import { Button } from "$lib/components";
import { pbUser } from "$lib/pocketbase";
import type { Snippet } from "svelte";
let { children }: { children: Snippet } = $props();
const scrape_official_data = async () => {
// TODO: Unauthorized toast
if (!$pbUser || !$pbUser.admin) return;
// TODO: Success/error toast
const response: Response = await fetch("/api/scrape", { method: "POST" });
};
@ -24,7 +28,13 @@
<!-- Each child's contents will be inserted here -->
<div style="margin-top: 56px;">
<div class="pb-2">
<Button width="w-full" color="tertiary" onclick={scrape_official_data} shadow>
<Button
width="w-full"
color="tertiary"
onclick={scrape_official_data}
shadow
disabled={!$pbUser?.admin}
>
<span class="font-bold">Refresh All Data</span>
</Button>
</div>