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

export const getLogs = createAsyncThunk('wooArchive/logs',async (page)=>{
    try {
        const { data } = await httpService.get("/wooArchive/api/v1/logs",{
            params:{page}
        })
        return data
    }catch (e) {
        return e.message;
    }
})

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

export const deleteLogs = createAsyncThunk('wooArchive/logs/delete',async (logData)=>{
    try {
        const { data } = await httpService.delete("/wooArchive/api/v1/logs",{
            data: logData
        })
        return data
    }catch (e) {
        return e.message;
    }
})