opnform/client/stores/records.js

22 lines
500 B
JavaScript
Raw Permalink Normal View History

2023-12-09 14:47:03 +00:00
import { defineStore } from 'pinia'
import { useContentStore } from '~/composables/stores/useContentStore'
2023-12-09 14:47:03 +00:00
/**
* Loads records from database
*/
export const useRecordsStore = defineStore('records', ()=>{
const contentStore = useContentStore()
const loadRecord = (request)=> {
contentStore.resetState()
contentStore.startLoading()
return request.then((data) => {
contentStore.save(data)
contentStore.stopLoading()
})
2023-12-09 14:47:03 +00:00
}
return {...contentStore, loadRecord}
})