mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
[bugfix]: fix smart playlist, do not error when trying to edit playlist as non-admin
This commit is contained in:
parent
44fcc33825
commit
6bc778fa53
3 changed files with 14 additions and 12 deletions
|
|
@ -76,7 +76,7 @@ export const UpdatePlaylistForm = ({ users, query, body, onCancel }: UpdatePlayl
|
|||
});
|
||||
|
||||
const isPublicDisplayed = server?.type === ServerType.NAVIDROME;
|
||||
const isOwnerDisplayed = server?.type === ServerType.NAVIDROME;
|
||||
const isOwnerDisplayed = server?.type === ServerType.NAVIDROME && userList;
|
||||
const isSubmitDisabled = !form.values.name || mutation.isLoading;
|
||||
|
||||
return (
|
||||
|
|
@ -154,11 +154,17 @@ export const openUpdatePlaylistModal = async (args: {
|
|||
|
||||
const users =
|
||||
server?.type === ServerType.NAVIDROME
|
||||
? await queryClient.fetchQuery({
|
||||
queryFn: ({ signal }) =>
|
||||
api.controller.getUserList({ apiClientProps: { server, signal }, query }),
|
||||
queryKey: queryKeys.users.list(server?.id || '', query),
|
||||
})
|
||||
? await queryClient
|
||||
.fetchQuery({
|
||||
queryFn: ({ signal }) =>
|
||||
api.controller.getUserList({ apiClientProps: { server, signal }, query }),
|
||||
queryKey: queryKeys.users.list(server?.id || '', query),
|
||||
})
|
||||
.catch((error) => {
|
||||
// This eror most likely happens if the user is not an admin
|
||||
console.error(error);
|
||||
return null;
|
||||
})
|
||||
: null;
|
||||
|
||||
openModal({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue