import { connectionJobsStore } from "./store";
import { getConnectionJobs } from "../api";
export async function handleGetConnectionJobs() {
    const { jobs } = await getConnectionJobs();
    const filteredJobs = jobs.filter(job => {
        if (job.channel === 'zwiz') {
            return job.user?.toLowerCase() !== 'completed' || job.chat_message?.toLowerCase() !== 'completed';
        }
        else {
            return job.init_state?.toLowerCase() !== 'completed';
        }
    });
    connectionJobsStore.set('jobs', filteredJobs);
    return filteredJobs;
}
