We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6b2142 commit cd1e7acCopy full SHA for cd1e7ac
1 file changed
src/store/userconfig.js
@@ -5,14 +5,32 @@
5
6
import { defineStore } from 'pinia'
7
import { set } from 'vue'
8
+import axios from 'axios'
9
10
export const useUserConfigStore = defineStore('userconfig', {
11
state: () => ({
12
grid_view: true,
13
}),
14
actions: {
15
async update(key, value) {
16
+ const oldValue = this[key]
17
+
18
set(this, key, value)
19
20
+ try {
21
+ const response = await axios.put(
22
+ `/apps/files/api/v1/config/${key}`,
23
+ { value }
24
+ )
25
26
+ if (response?.data?.value !== undefined) {
27
+ set(this, key, response.data.value)
28
+ }
29
+ } catch (error) {
30
+ console.error('Erro ao salvar configuração:', error)
31
32
+ set(this, key, oldValue)
33
34
},
35
36
})
0 commit comments