File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments