Skip to content

Commit cd1e7ac

Browse files
committed
chore: gridViewButtonLabel
Signed-off-by: Crisciany Souza <criscianysilva1997@gmail.com>
1 parent c6b2142 commit cd1e7ac

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/store/userconfig.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,32 @@
55

66
import { defineStore } from 'pinia'
77
import { set } from 'vue'
8+
import axios from 'axios'
89

910
export const useUserConfigStore = defineStore('userconfig', {
1011
state: () => ({
1112
grid_view: true,
1213
}),
1314
actions: {
1415
async update(key, value) {
16+
const oldValue = this[key]
17+
1518
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+
}
1634
},
1735
},
1836
})

0 commit comments

Comments
 (0)