18 lines
451 B
TypeScript
18 lines
451 B
TypeScript
import { defineStore } from 'pinia';
|
|
import { getEntryBySlug, updateEntry } from '~/scripts/api.js';
|
|
|
|
export const usePersonenStore = defineStore('personen', {
|
|
state: () => ({
|
|
personen: {} as { [key: string]: any },
|
|
}),
|
|
actions: {
|
|
async loadRemote(slug: string) {
|
|
const result = await getEntryBySlug(slug);
|
|
this.personen = result?.data || {};
|
|
},
|
|
async saveRemote(slug: string) {
|
|
await updateEntry(slug, this.personen);
|
|
}
|
|
},
|
|
});
|