mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-04-11 07:25:42 -04:00
chore: Nuxt 4 upgrade (#7426)
This commit is contained in:
20
frontend/app/lib/api/user/utils.ts
Normal file
20
frontend/app/lib/api/user/utils.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { BaseAPI } from "../base/base-clients";
|
||||
import type { FileTokenResponse } from "~/lib/api/types/response";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
export class UtilsAPI extends BaseAPI {
|
||||
async download(url: string) {
|
||||
const { response } = await this.requests.get<FileTokenResponse>(url);
|
||||
|
||||
if (!response) {
|
||||
return;
|
||||
}
|
||||
|
||||
const token: string = response.data.fileToken;
|
||||
|
||||
const tokenURL = prefix + "/utils/download?token=" + token;
|
||||
window.open(tokenURL, "_blank");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user