Skip to content

Commit ddc31e7

Browse files
fix(snippets): remove prev characters by typing name #347 (#351)
1 parent ea15d51 commit ddc31e7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/renderer/store/snippets.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,20 +103,21 @@ export const useSnippetStore = defineStore('snippets', {
103103
}
104104
},
105105
async patchSnippetsById (id: string, body: Partial<Snippet>) {
106-
const { data } = await useApi(`/snippets/${id}`).patch(body).json()
107106
const snippet = this.snippets.find(i => i.id === id)
108107

109108
if (!snippet) return
110109

111110
if (snippet.id === this.selectedId) {
112-
for (const props in data.value) {
113-
(this.selected as any)[props] = data.value[props]
111+
for (const props in body) {
112+
(this.selected as any)[props] = (body as any)[props]
114113
}
115114
}
116115

117-
for (const props in data.value) {
118-
(snippet as any)[props] = data.value[props]
116+
for (const props in body) {
117+
(snippet as any)[props] = (body as any)[props]
119118
}
119+
120+
await useApi(`/snippets/${id}`).patch(body).json()
120121
},
121122
async patchCurrentSnippetContentByKey (
122123
key: keyof SnippetContent,

0 commit comments

Comments
 (0)