Implement reordering with optimistic updates

This commit is contained in:
2025-11-24 01:03:46 +05:00
parent 133558c4ab
commit 05814a100a
11 changed files with 271 additions and 63 deletions

View File

@ -0,0 +1,24 @@
import { defineStore } from 'pinia'
import type { PlaylistReadResponse } from '~/composeables/api/models'
export const useCurrentPlaylistStore = defineStore('current-playlist', {
state: () => ({
id: -1,
ownerId: -1,
title: '',
createdAt: '',
updatedAt: '',
}),
getters: {
getId: (state) => state.id * 2,
},
actions: {
load(response: PlaylistReadResponse) {
this.id = response.id || -1;
this.ownerId = response.ownerId || -1;
this.title = response.title || '';
this.createdAt = response.createdAt || '';
this.updatedAt = response.updatedAt || '';
}
},
})