feat(frontend): layout header + drawer + router (9 routes)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref } from 'vue';
|
||||
import { plantingsApi } from '@/api/plantings';
|
||||
export const usePlantingsStore = defineStore('plantings', () => {
|
||||
const plantings = ref([]);
|
||||
const loading = ref(false);
|
||||
async function fetchAll() {
|
||||
loading.value = true;
|
||||
plantings.value = await plantingsApi.list();
|
||||
loading.value = false;
|
||||
}
|
||||
async function create(p) {
|
||||
const created = await plantingsApi.create(p);
|
||||
plantings.value.push(created);
|
||||
return created;
|
||||
}
|
||||
async function remove(id) {
|
||||
await plantingsApi.delete(id);
|
||||
plantings.value = plantings.value.filter(p => p.id !== id);
|
||||
}
|
||||
return { plantings, loading, fetchAll, create, remove };
|
||||
});
|
||||
Reference in New Issue
Block a user