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

export const getTables = createAsyncThunk('wooArchive/getTables',async (paged)=>{
    try {
        const { data } = await httpService.get("/wooArchive/api/v1/sync/tables")
        return data
    }catch (error) {
        return error.message;
    }
})

export const insertTables = createAsyncThunk('wooArchive/insert/tables',async (table)=>{
    try {
        const { data } = await httpService.post("/wooArchive/api/v1/sync/tables",table)
        return data
    }catch (e) {
        return e.message;
    }
})

export const insertTableData = createAsyncThunk('wooArchive/insert/tables/data',async (tableData)=>{
    try {
        const { data } = await httpService.post("/wooArchive/api/v1/sync/tables/data",tableData)
        return data
    }catch (e) {
        return e.message;
    }
})