mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Move validation checks earlier
This commit is contained in:
parent
a37388b2e3
commit
3ad0fb02e4
1 changed files with 6 additions and 6 deletions
|
@ -84,12 +84,12 @@ function onSubmit(this: HTMLElement, e: Event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPlaylist(dlg: DialogElement) {
|
function createPlaylist(dlg: DialogElement) {
|
||||||
const apiClient = ServerConnections.getApiClient(currentServerId);
|
|
||||||
const api = toApi(apiClient);
|
|
||||||
|
|
||||||
const name = dlg.querySelector<HTMLInputElement>('#txtNewPlaylistName')?.value;
|
const name = dlg.querySelector<HTMLInputElement>('#txtNewPlaylistName')?.value;
|
||||||
if (isBlank(name)) return Promise.reject(new Error('Playlist name should not be blank'));
|
if (isBlank(name)) return Promise.reject(new Error('Playlist name should not be blank'));
|
||||||
|
|
||||||
|
const apiClient = ServerConnections.getApiClient(currentServerId);
|
||||||
|
const api = toApi(apiClient);
|
||||||
|
|
||||||
const itemIds = dlg.querySelector<HTMLInputElement>('.fldSelectedItemIds')?.value || undefined;
|
const itemIds = dlg.querySelector<HTMLInputElement>('.fldSelectedItemIds')?.value || undefined;
|
||||||
|
|
||||||
return getPlaylistsApi(api)
|
return getPlaylistsApi(api)
|
||||||
|
@ -114,14 +114,14 @@ function redirectToPlaylist(id: string | undefined) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePlaylist(dlg: DialogElement) {
|
function updatePlaylist(dlg: DialogElement) {
|
||||||
const apiClient = ServerConnections.getApiClient(currentServerId);
|
|
||||||
const api = toApi(apiClient);
|
|
||||||
|
|
||||||
if (!dlg.playlistId) return Promise.reject(new Error('Missing playlist ID'));
|
if (!dlg.playlistId) return Promise.reject(new Error('Missing playlist ID'));
|
||||||
|
|
||||||
const name = dlg.querySelector<HTMLInputElement>('#txtNewPlaylistName')?.value;
|
const name = dlg.querySelector<HTMLInputElement>('#txtNewPlaylistName')?.value;
|
||||||
if (isBlank(name)) return Promise.reject(new Error('Playlist name should not be blank'));
|
if (isBlank(name)) return Promise.reject(new Error('Playlist name should not be blank'));
|
||||||
|
|
||||||
|
const apiClient = ServerConnections.getApiClient(currentServerId);
|
||||||
|
const api = toApi(apiClient);
|
||||||
|
|
||||||
return getPlaylistsApi(api)
|
return getPlaylistsApi(api)
|
||||||
.updatePlaylist({
|
.updatePlaylist({
|
||||||
playlistId: dlg.playlistId,
|
playlistId: dlg.playlistId,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue