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