1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

JS: Converted http service to ts

This commit is contained in:
Dan Brown
2024-07-18 15:13:14 +01:00
parent 634b0aaa07
commit fb87fb5750
6 changed files with 234 additions and 244 deletions

View File

@ -1,6 +1,7 @@
// Docs: https://www.diagrams.net/doc/faq/embed-mode
import * as store from './store';
import {ConfirmDialog} from "../components";
import {HttpError} from "./http";
type DrawioExportEventResponse = {
action: 'export',
@ -145,9 +146,10 @@ export function close() {
export async function load(drawingId: string): Promise<string> {
try {
const resp = await window.$http.get(window.baseUrl(`/images/drawio/base64/${drawingId}`));
return `data:image/png;base64,${resp.data.content}`;
const data = resp.data as {content: string};
return `data:image/png;base64,${data.content}`;
} catch (error) {
if (error instanceof window.$http.HttpError) {
if (error instanceof HttpError) {
window.$events.showResponseError(error);
}
close();