2021-10-29 18:55:28 -08:00
|
|
|
export const isWritable = (ownerId) => {
|
2020-06-05 06:22:31 -08:00
|
|
|
return (
|
2021-10-29 18:55:28 -08:00
|
|
|
localStorage.getItem('userId') === ownerId ||
|
2020-06-05 06:22:31 -08:00
|
|
|
localStorage.getItem('role') === 'admin'
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-29 18:55:28 -08:00
|
|
|
export const isReadOnly = (ownerId) => {
|
|
|
|
|
return !isWritable(ownerId)
|
2020-06-05 06:22:31 -08:00
|
|
|
}
|
|
|
|
|
|
2021-10-22 17:11:44 -08:00
|
|
|
export const isSmartPlaylist = (pls) => !!pls.rules
|
|
|
|
|
|
|
|
|
|
export const canChangeTracks = (pls) =>
|
2021-10-29 18:55:28 -08:00
|
|
|
isWritable(pls.ownerId) && !isSmartPlaylist(pls)
|