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

export const useStaticsStore = defineStore('statics', {
    state: () => ({
        items: [],
        fetching: true,
        total: 0
    }),
    actions: {
        async index() {
            this.fetching = true
            const { status, data } = await axios.get('/admin/settings')
            this.fetching = false
            if (status === 200) {
                 this.items = data
                // this.total = data.total
            }
        },
        async edit(data) {
            this.fetching = true
            const result =  await axios.patch('/admin/settings/edit', data)
            this.fetching = false
            return result
        },
  
    }
})