diff options
author | vnugent <public@vaughnnugent.com> | 2024-02-02 21:14:19 -0500 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-02-02 21:14:19 -0500 |
commit | 52645b724834e669788a45edb9d135f243432540 (patch) | |
tree | 56a5ea56fdf339f00934b3e4cd88212ea3608b29 /front-end/src/store/bookmarks.ts | |
parent | dd5e5164262c5ff7ecf6db1003d41d81e6364c09 (diff) |
download file formats, button tweaks, more cache infra
Diffstat (limited to 'front-end/src/store/bookmarks.ts')
-rw-r--r-- | front-end/src/store/bookmarks.ts | 8 |
1 files changed, 5 insertions, 3 deletions
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<Bookmark[]> add: (bookmark: Bookmark) => Promise<void> @@ -51,7 +53,7 @@ export interface BookmarkApi{ getTags: () => Promise<string[]> delete: (bookmark: Bookmark | Bookmark[]) => Promise<void> count: () => Promise<number> - downloadAll: () => Promise<string> + downloadAll: (contentType: DownloadContentType) => Promise<string> } export interface BookmarkSearch{ @@ -141,10 +143,10 @@ const useBookmarkApi = (endpoint: MaybeRef<string>): BookmarkApi => { return data.result; } - const downloadAll = async () => { + const downloadAll = async (contentType: DownloadContentType) => { //download the bookmarks as a html file const { data } = await axios.get<string>(`${get(endpoint)}?export=true`, { - headers: { 'Content-Type': 'application/htlm' } + headers: { 'Accept': contentType } }) return data; } |