Improved wording for Background Job tracking

This commit is contained in:
Matthias 2024-11-03 08:51:44 +01:00
parent 377d038dc2
commit 8038b0efd4
2 changed files with 4 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import { AxiosInstance } from 'axios';
const jobs = ref<Record<string, { jobType: string; status: string }>>({}); const jobs = ref<Record<string, { jobType: string; status: string }>>({});
export function useBackgroundJob() { export function useBackgroundJob() {
function start(api: AxiosInstance, showAlert: any, jobId: string, jobType: string) { function startBgJob(api: AxiosInstance, showAlert: any, jobId: string, jobType: string) {
async function getBackgroundJobStatus(jobId: string) { async function getBackgroundJobStatus(jobId: string) {
try { try {
const { data } = await api.get<BackgroundTaskStatus>(`/background/${jobId}`); const { data } = await api.get<BackgroundTaskStatus>(`/background/${jobId}`);
@ -51,6 +51,6 @@ export function useBackgroundJob() {
return { return {
runningJobs, runningJobs,
start, startBgJob,
}; };
} }

View File

@ -711,6 +711,8 @@ export function createBotSubStore(botId: string, botName: string) {
'/download_data', '/download_data',
payload, payload,
); );
const { startBgJob } = useBackgroundJob();
startBgJob(api, showAlert, data.job_id, 'download_data');
return Promise.resolve(data); return Promise.resolve(data);
} catch (error) { } catch (error) {
console.error(error); console.error(error);