import { handleError, handleSuccess } from '.';
import axios from '../lib/axios';

const BASE_URL = 'dashboards';

export const resetTool = async () => {
    try {
        const { data } = await axios({
            url: `${BASE_URL}/reset-tool`,
            withCredentials: true,
            method: 'POST',
        });

        handleSuccess(data);

        return data;
    } catch (error) {
        handleError(error);
    }
};

export const shutdownTool = async () => {
    try {
        const { data } = await axios({
            url: `${BASE_URL}/shutdown-tool`,
            withCredentials: true,
            method: 'POST',
        });

        handleSuccess(data);

        return data;
    } catch (error) {
        handleError(error);
    }
};


export const getStatusTool = async () => {
    try {
        const { data } = await axios({
            url: `${BASE_URL}/status-tool`,
            withCredentials: true,
            method: 'GET',
        });

        return data;
    } catch (error) {
        handleError(error);
    }
};