Dieser Commit ist enthalten in:
Ursprung
fe37a70d26
Commit
a70b00ae14
17
src/components/SchematicDownload.svelte
Normale Datei
17
src/components/SchematicDownload.svelte
Normale Datei
@ -0,0 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { schemRepo } from "@repo/schem.ts";
|
||||
|
||||
$: code = new URLSearchParams(window.location.search).get("code") || "";
|
||||
|
||||
$: downloadUrl = $schemRepo.getSchematicDownloadUrl(code);
|
||||
$: schematic = $schemRepo.getSchematicCodeInfo(code);
|
||||
</script>
|
||||
|
||||
{#await schematic then schem}
|
||||
<h1 class="text-2xl font-bold">{schem.name}</h1>
|
||||
<div class="flex justify-center">
|
||||
<a href={downloadUrl} class="btn" target="_blank">Download</a>
|
||||
</div>
|
||||
{:catch error}
|
||||
<p>{error.message}</p>
|
||||
{/await}
|
@ -39,11 +39,11 @@ export class SchematicRepo {
|
||||
}
|
||||
|
||||
public async getSchematicCodeInfo(code: string): Promise<Schematic> {
|
||||
return await fetchWithToken(this.token, `/schem/download/${code}/info`).then(value => value.json()).then(SchematicSchema.parse);
|
||||
return await fetchWithToken(this.token, `/download/${code}/info`).then(value => value.json()).then(SchematicSchema.parse);
|
||||
}
|
||||
|
||||
public getSchematicDownloadUrl(code: string): string {
|
||||
return `/schem/download/${code}`;
|
||||
return `${import.meta.env.PUBLIC_API_SERVER}/download/${code}`;
|
||||
}
|
||||
|
||||
public async uploadSchematic(name: string, content: string) {
|
||||
|
8
src/pages/schematic.astro
Normale Datei
8
src/pages/schematic.astro
Normale Datei
@ -0,0 +1,8 @@
|
||||
---
|
||||
import PageLayout from "../layouts/PageLayout.astro";
|
||||
import SchematicDownload from "@components/SchematicDownload.svelte";
|
||||
---
|
||||
|
||||
<PageLayout title={""}>
|
||||
<SchematicDownload client:only="svelte" />
|
||||
</PageLayout>
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren