mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	* add annotations to docs * alchemy data dumper * initial tests * sourcery refactor * db backups/restore * potential postgres fix * potential postgres fix * this is terrible * potential pg fix * cleanup * remove unused import * fix comparison * generate frontend types * update timestamp and add directory filter * rewrite to new admin-api * update backup routers * add file_token response helper * update imports * remove test_backup
		
			
				
	
	
		
			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;
 | |
|   }
 | |
| }
 |