Switched to type `Tasks` & message cleanup

This commit is contained in:
n8detar 2022-04-23 11:37:46 -07:00
parent 0ea19defcc
commit e41ac9276b
1 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,8 @@
import { Download, Task } from "../types/download"; import { Download, Task, Tasks } from "../types/download";
import { getTAUrl } from "./constants"; import { getTAUrl } from "./constants";
const TA_BASE_URL = getTAUrl(); const TA_BASE_URL = getTAUrl();
export const getDownloads = async (token: string, filter: boolean, pageNumber: number): Promise<Download> => { export const getDownloads = async (token: string, filter: boolean, pageNumber: number): Promise<Download> => {
@ -108,7 +110,7 @@ export const sendMoveVideoQueuedIgnored = async (token: string, videoId: string,
return response.json(); return response.json();
}; };
export const sendTasks = async (token: string, task: string): Promise<Task> => { export const sendTasks = async (token: string, task: Tasks): Promise<Task> => {
var data = { var data = {
"run": task "run": task
}; };
@ -123,7 +125,7 @@ export const sendTasks = async (token: string, task: string): Promise<Task> => {
method: "POST" method: "POST"
}); });
if (!response.ok) { if (!response.ok) {
throw new Error("Error running task: " + task + "."); throw new Error(`Error running task: ${task}.`);
} }
return response.json(); return response.json();
}; };