Skip to content

Commit a51ce50

Browse files
committed
refactor cached playlist structure
1 parent 7c9413c commit a51ce50

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

apps/pwa/src/pages/player/storage.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ export enum Key {
88
const storage = new Storage<
99
Key,
1010
{
11-
[Key.PLAYLIST]: {
12-
userId: string;
13-
musicList: MusicWithSingerAliases[];
14-
};
11+
[Key.PLAYLIST]: MusicWithSingerAliases[];
1512
}
1613
>('player');
1714

apps/pwa/src/pages/player/use_playlist.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,14 @@ import { t } from '@/i18n';
66
import { PlaylistMusic } from './constants';
77
import eventemitter, { EventType } from './eventemitter';
88
import storage, { Key } from './storage';
9-
import {
10-
getSelectedServer,
11-
getSelectedUser,
12-
useServer,
13-
} from '@/global_states/server';
149

1510
export default () => {
1611
const [playlist, setPlaylist] = useState<PlaylistMusic[]>([]);
1712

1813
useEffect(
1914
() =>
2015
playlist && playlist.length > 0
21-
? void storage.setItem(Key.PLAYLIST, {
22-
userId: getSelectedUser(getSelectedServer(useServer.getState())!)!
23-
.id,
24-
musicList: playlist,
25-
})
16+
? void storage.setItem(Key.PLAYLIST, playlist)
2617
: undefined,
2718
[playlist],
2819
);

0 commit comments

Comments
 (0)