changes
This commit is contained in:
@@ -65,8 +65,8 @@ export class PageRepo {
|
||||
await fetchWithToken(this.token, "/page/branch", {method: "DELETE", body: JSON.stringify({branch})});
|
||||
}
|
||||
|
||||
public async createFile(path: string, branch: string = "master"): Promise<void> {
|
||||
await fetchWithToken(this.token, `/page?branch=${branch}`, {method: "POST", body: JSON.stringify({path})});
|
||||
public async createFile(path: string, branch: string = "master", slug: string | null = null, title: string | null = null): Promise<void> {
|
||||
await fetchWithToken(this.token, `/page?branch=${branch}`, {method: "POST", body: JSON.stringify({path, slug, title})});
|
||||
}
|
||||
|
||||
public async merge(branch: string, message: string): Promise<void> {
|
||||
|
||||
@@ -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