import { createAsyncThunk } from "@reduxjs/toolkit";
import httpService from "./httpService";

export const archiveOrders = createAsyncThunk('wooArchive/archive',async (archiveData)=>{
    try {
        const { data } = await httpService.post("/wooArchive/api/v1/archive",archiveData)
        return data
    }catch (e) {
        return e.message;
    }
})

export const archiveOrdersDelete = createAsyncThunk('wooArchive/archive/delete',async (archiveData)=>{
    try {
        const { data } = await httpService.post("/wooArchive/api/v1/archive/delete",archiveData)
        return data
    }catch (e) {
        return e.message;
    }
})

export const startBgProcess = createAsyncThunk('wooArchive/startBgProcess',async ()=>{
    try {
        const { data } = await httpService.post("/wooArchive/api/v1/archive/start/background_process")
        return data
    }catch (e) {
        return e.message;
    }
})