Skip to content

Commit dea7dc2

Browse files
committed
feat(snippets): sort by date
1 parent 3d1e88d commit dea7dc2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/renderer/store/snippets.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export const useSnippetStore = defineStore('snippets', {
3737
snippets.push(...data.value)
3838
}
3939

40-
this.snippets = snippets
40+
this.snippets = snippets.sort((a, b) =>
41+
a.createdAt > b.createdAt ? -1 : 1
42+
)
4143
},
4244
async getSnippetsById (id: string) {
4345
const { data } = await useApi<Snippet>(`/snippets/${id}`).get().json()

0 commit comments

Comments
 (0)