diff options
Diffstat (limited to 'front-end/src/store')
-rw-r--r-- | front-end/src/store/bookmarks.ts | 8 | ||||
-rw-r--r-- | front-end/src/store/index.ts | 2 |
2 files changed, 7 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; } diff --git a/front-end/src/store/index.ts b/front-end/src/store/index.ts index c13edcb..bcd79ad 100644 --- a/front-end/src/store/index.ts +++ b/front-end/src/store/index.ts @@ -19,6 +19,8 @@ import { noop, toSafeInteger, toString, defaults } from "lodash-es"; import { defineStore } from "pinia"; import { computed, shallowRef, watch } from "vue"; +export type { DownloadContentType } from './bookmarks' + export const useQuery = (name: string) => { const getQuery = () => { |