2022-04-15 17:00:08 +00:00
|
|
|
import { reactive } from 'vue'
|
2022-04-15 14:24:30 +00:00
|
|
|
import { http } from '@/services'
|
|
|
|
|
|
|
|
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
|
|
|
},
|
|
|
|
|
|
|
|
get all () {
|
2022-04-15 17:00:08 +00:00
|
|
|
return this.state
|
2022-04-15 14:24:30 +00:00
|
|
|
},
|
|
|
|
|
2022-04-21 22:20:21 +00:00
|
|
|
async update (settings: Settings) {
|
|
|
|
await http.put('settings', settings)
|
|
|
|
Object.assign(this.state, settings)
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
2022-04-15 17:00:08 +00:00
|
|
|
}
|