mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-24 01:12:54 -04:00
* Fix or comment several ts-ignores * Fix typing related to BaseOverflowButton * Remove unused functionality of useCookbooks, fix usage bug * Fix more typing, add some comments * Only allow ts-ignore if it has a comment
24 lines
474 B
TypeScript
24 lines
474 B
TypeScript
import { BaseAPI } from "../_base";
|
|
|
|
const prefix = "/api";
|
|
|
|
interface DownloadData {
|
|
fileToken: string,
|
|
}
|
|
|
|
export class UtilsAPI extends BaseAPI {
|
|
async download(url: string) {
|
|
const { response } = await this.requests.get<DownloadData>(url);
|
|
|
|
if (!response) {
|
|
return;
|
|
}
|
|
|
|
const token: string = response.data.fileToken;
|
|
|
|
const tokenURL = prefix + "/utils/download?token=" + token;
|
|
window.open(tokenURL, "_blank");
|
|
return response;
|
|
}
|
|
}
|