changes
This commit is contained in:
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import {fetchWithToken, tokenStore} from "./repo.ts";
|
||||
import type {SchematicInfo, SchematicList} from "@type/schem.ts";
|
||||
import {type Schematic, type SchematicInfo, type SchematicList, SchematicSchema} from "@type/schem.ts";
|
||||
import {SchematicInfoSchema, SchematicListSchema} from "@type/schem.ts";
|
||||
import {derived} from "svelte/store";
|
||||
|
||||
@ -38,6 +38,14 @@ export class SchematicRepo {
|
||||
return await fetchWithToken(this.token, `/schem/${id}`).then(value => value.json()).then(SchematicInfoSchema.parse);
|
||||
}
|
||||
|
||||
public async getSchematicCodeInfo(code: string): Promise<Schematic> {
|
||||
return await fetchWithToken(this.token, `/schem/download/${code}/info`).then(value => value.json()).then(SchematicSchema.parse);
|
||||
}
|
||||
|
||||
public getSchematicDownloadUrl(code: string): string {
|
||||
return `/schem/download/${code}`;
|
||||
}
|
||||
|
||||
public async uploadSchematic(name: string, content: string) {
|
||||
return await fetchWithToken(this.token, "/schem", {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user