2022-04-15 17:00:08 +00:00
|
|
|
import { reactive } from 'vue'
|
2022-09-15 09:07:25 +00:00
|
|
|
import { http } from '@/services'
|
2022-07-23 11:10:41 +00:00
|
|
|
import { merge } from 'lodash'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
|
|
|
export const settingStore = {
|
2022-04-15 17:00:08 +00:00
|
|
|
state: reactive<Settings>({
|
2024-10-13 17:37:01 +00:00
|
|
|
media_path: '',
|
2022-04-15 17:00:08 +00:00
|
|
|
}),
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
init (settings: Settings) {
|
2022-07-23 11:10:41 +00:00
|
|
|
merge(this.state, settings)
|
2022-04-15 14:24:30 +00:00
|
|
|
},
|
|
|
|
|
2022-04-21 22:20:21 +00:00
|
|
|
async update (settings: Settings) {
|
2022-09-15 09:07:25 +00:00
|
|
|
await http.put('settings', settings)
|
2022-07-23 11:10:41 +00:00
|
|
|
merge(this.state, settings)
|
2024-10-13 17:37:01 +00:00
|
|
|
},
|
2022-04-15 17:00:08 +00:00
|
|
|
}
|