From 52645b724834e669788a45edb9d135f243432540 Mon Sep 17 00:00:00 2001 From: vnugent Date: Fri, 2 Feb 2024 21:14:19 -0500 Subject: download file formats, button tweaks, more cache infra --- front-end/src/store/bookmarks.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'front-end/src/store/bookmarks.ts') diff --git a/front-end/src/store/bookmarks.ts b/front-end/src/store/bookmarks.ts index b0595e9..76cc5b9 100644 --- a/front-end/src/store/bookmarks.ts +++ b/front-end/src/store/bookmarks.ts @@ -43,6 +43,8 @@ export interface BookmarkError{ }> } +export type DownloadContentType = 'application/json' | 'text/html' | 'text/csv' | 'text/plain' + export interface BookmarkApi{ list: (page: number, limit: number, search: BookmarkSearch) => Promise add: (bookmark: Bookmark) => Promise @@ -51,7 +53,7 @@ export interface BookmarkApi{ getTags: () => Promise delete: (bookmark: Bookmark | Bookmark[]) => Promise count: () => Promise - downloadAll: () => Promise + downloadAll: (contentType: DownloadContentType) => Promise } export interface BookmarkSearch{ @@ -141,10 +143,10 @@ const useBookmarkApi = (endpoint: MaybeRef): BookmarkApi => { return data.result; } - const downloadAll = async () => { + const downloadAll = async (contentType: DownloadContentType) => { //download the bookmarks as a html file const { data } = await axios.get(`${get(endpoint)}?export=true`, { - headers: { 'Content-Type': 'application/htlm' } + headers: { 'Accept': contentType } }) return data; } -- cgit