diff --git a/client/src/i18n/de.json b/client/src/i18n/de.json index 2338ebb..fe2859f 100644 --- a/client/src/i18n/de.json +++ b/client/src/i18n/de.json @@ -21,6 +21,8 @@ "back": "Zurück", "close": "Schließen", "save": "Speichern", + "publish": "Veröffentlichen", + "savedraft": "Als Entwurf speichern", "cancel": "Abbrechen", "edit": "Bearbeiten", "delete": "Löschen", @@ -29,7 +31,9 @@ "roles": "Rollen", "login": "Anmelden", "githubLinkText": "Die Blog-Software auf GitHub", - "startpage": "Startseite" + "startpage": "Startseite", + "restore": "Wiederherstellen", + "discard": "Verwerfen" } }, "nav": { @@ -59,7 +63,8 @@ "tags": "Schlagworte", "enter": "Geben Sie Schlagworte ein..." }, - "imageupload": "keine angehängten Bilder | ein angehängtes Bild | {count} angehängte Bilder" + "imageupload": "keine angehängten Bilder | ein angehängtes Bild | {count} angehängte Bilder", + "restore": "Unveröffentlichte Version gefunden" }, "confirm": { "title": "Löschen bestätigen", @@ -69,7 +74,7 @@ "not-available": { "title": "Post nicht vorhanden", "message": "Der Post ist nicht verfügbar oder wurde gelöscht. Sie können mit dem Button zur Startseite zurück, oder nutzen sie die Suchfunktion um einen bestimmten Post zu finden." - } + } } }, "admin": { diff --git a/client/src/i18n/en.json b/client/src/i18n/en.json index 0a73092..cf765b1 100644 --- a/client/src/i18n/en.json +++ b/client/src/i18n/en.json @@ -21,6 +21,8 @@ "back": "Back", "close": "Close", "save": "Save", + "publish": "Publish", + "savedraft": "Save draft", "cancel": "Cancel", "edit": "Edit", "delete": "Delete", @@ -29,7 +31,9 @@ "roles": "Roles", "login": "Login", "githubLinkText": "The blog software on GitHub", - "startpage": "Startpage" + "startpage": "Startpage", + "restore": "Restore", + "discard": "Discard" } }, "nav": { @@ -56,7 +60,8 @@ "title": "Preview" }, "imageupload": "Upload image", - "tags": "Tags" + "tags": "Tags", + "restore": "Unpublished version found" }, "confirm": { "title": "Confirm deletion", @@ -66,7 +71,7 @@ "not-available": { "title": "Post not available", "message": "This post is not available or has been deleted. You can find all posts in the overview, or use the search function to find a specific post." - } + } } }, "admin": { diff --git a/client/src/util/api-client.ts b/client/src/util/api-client.ts index 6f8d423..6e9221b 100644 --- a/client/src/util/api-client.ts +++ b/client/src/util/api-client.ts @@ -2,7 +2,7 @@ import { loadIdToken, updateIdToken } from "@client/util/storage.js"; import type { AiSummaryData, DataUrl, - DraftResponseDto, + SavePostResponseDto, EditPostRequestDto, JsonMimeType, NewPostRequestDto, @@ -19,7 +19,7 @@ async function callServer< ResponseType = ResponseMimeType extends JsonMimeType ? any : ResponseMimeType extends SupportedImageMimeType ? ArrayBuffer : any, >( url: ApiUrl, - method: "GET" | "POST", + method: "GET" | "POST" | "DELETE" | "PUT", responseType: ResponseMimeType, payload: ApiRequestJsonPayload | null = null, authenticated = true, @@ -113,19 +113,19 @@ export class OpenAiEndpoints { } export class PostEndpoints { - static async createPostWithoutFiles(json: NewPostRequestDto): Promise { - return callServer("/api/posts/new", "POST", "application/json", { json: json }); + static async createPostWithoutFiles(json: NewPostRequestDto): Promise { + return callServer("/api/posts/new", "POST", "application/json", { json: json }); } - static async createPost(json: NewPostRequestDto, files: File[]): Promise { - return callServer( + static async createPost(json: NewPostRequestDto, files: File[]): Promise { + return callServer( "/api/posts/new", "POST", "application/json", new ApiRequestJsonPayloadWithFiles(json, files), ); } - static async editPost(json: EditPostRequestDto, files: File[]): Promise { - return callServer( + static async editPost(json: EditPostRequestDto, files: File[]): Promise { + return callServer( `/api/posts/${json.id}`, "POST", "application/json", @@ -133,6 +133,9 @@ export class PostEndpoints { ); } static async deletePost(id: number): Promise<{ affected: number }> { - return callServer(`/api/posts/delete/${id}`, "POST", "application/json"); + return callServer(`/api/posts/${id}`, "DELETE", "application/json"); + } + static async deleteAutosave(id: number): Promise<{ affected: number }> { + return callServer(`/api/posts/autosave/${id}`, "DELETE", "application/json"); } } diff --git a/client/src/views/PostFormView.vue b/client/src/views/PostFormView.vue index 8e8dfa7..7644997 100644 --- a/client/src/views/PostFormView.vue +++ b/client/src/views/PostFormView.vue @@ -1,10 +1,39 @@