Macrame/fe/src/stores/panel.js
2025-04-05 23:23:51 +02:00

24 lines
501 B
JavaScript

import { appUrl } from '@/services/ApiService'
import axios from 'axios'
import { defineStore } from 'pinia'
import { ref } from 'vue'
export const usePanelStore = defineStore('panel', () => {
const list = ref([])
const getPanels = async () => {
console.log(list.value.length)
if (list.value.length > 0) return list.value
const resp = await axios.post(appUrl() + '/panel/list')
list.value = resp.data.data
return list.value
}
return {
list,
getPanels,
}
})