koel/resources/assets/js/stores/settingStore.ts

18 lines
367 B
TypeScript
Raw Normal View History

2022-04-15 17:00:08 +00:00
import { reactive } from 'vue'
2022-04-24 08:50:45 +00:00
import { httpService } from '@/services'
2022-04-15 14:24:30 +00:00
export const settingStore = {
2022-04-15 17:00:08 +00:00
state: reactive<Settings>({
media_path: ''
}),
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
init (settings: Settings) {
Object.assign(this.state, settings)
2022-04-15 14:24:30 +00:00
},
2022-04-21 22:20:21 +00:00
async update (settings: Settings) {
2022-04-24 08:50:45 +00:00
await httpService.put('settings', settings)
2022-04-21 22:20:21 +00:00
Object.assign(this.state, settings)
2022-04-15 14:24:30 +00:00
}
2022-04-15 17:00:08 +00:00
}