Files
frontend/app/stores/use-current-playlist-store.ts

25 lines
703 B
TypeScript

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 || '';
}
},
})