import axios from '../plugins/axios'
import { defineStore } from 'pinia'

export const useFaqStore = defineStore('faq', {
    state: () => ({
        items: [],
        fetching: true,
        total: 0
    }),
    actions: {
        async index() {
            this.items = [];
            this.fetching = true
            const { status, data } = await axios.get('/admins/faq/category')
            this.fetching = false
            this.items = data;

        },
        async remove(id) {
            const data = await axios.delete(`/admins/faq/category/${id}`)
        return data
        },
        async create(form) {
            const data = await axios.post('/admins/faq/category', form)
        return data
        },
    }
})