2023-12-09 14:47:03 +00:00
|
|
|
import { defineStore } from 'pinia'
|
2024-02-03 11:50:57 +00:00
|
|
|
import { useContentStore } from '~/composables/stores/useContentStore'
|
2023-12-09 14:47:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads records from database
|
|
|
|
*/
|
2024-02-03 11:50:57 +00:00
|
|
|
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
|
|
|
}
|
2024-02-03 11:50:57 +00:00
|
|
|
return {...contentStore, loadRecord}
|
|
|
|
|
|
|
|
})
|