mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #6148 from nielsvanvelzen/fix-no-device-options
Fix editing device info when there are no options yet
This commit is contained in:
commit
3a6aaf2c8b
1 changed files with 5 additions and 5 deletions
|
@ -6,7 +6,7 @@ import Dashboard from '../../../utils/dashboard';
|
||||||
import { getParameterByName } from '../../../utils/url.ts';
|
import { getParameterByName } from '../../../utils/url.ts';
|
||||||
|
|
||||||
function load(page, device, deviceOptions) {
|
function load(page, device, deviceOptions) {
|
||||||
page.querySelector('#txtCustomName', page).value = deviceOptions.CustomName || '';
|
page.querySelector('#txtCustomName', page).value = deviceOptions?.CustomName || '';
|
||||||
page.querySelector('.reportedName', page).innerText = device.Name || '';
|
page.querySelector('.reportedName', page).innerText = device.Name || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,13 +14,13 @@ function loadData() {
|
||||||
const page = this;
|
const page = this;
|
||||||
loading.show();
|
loading.show();
|
||||||
const id = getParameterByName('id');
|
const id = getParameterByName('id');
|
||||||
const promise1 = ApiClient.getJSON(ApiClient.getUrl('Devices/Info', {
|
const device = ApiClient.getJSON(ApiClient.getUrl('Devices/Info', {
|
||||||
Id: id
|
Id: id
|
||||||
}));
|
}));
|
||||||
const promise2 = ApiClient.getJSON(ApiClient.getUrl('Devices/Options', {
|
const deviceOptions = ApiClient.getJSON(ApiClient.getUrl('Devices/Options', {
|
||||||
Id: id
|
Id: id
|
||||||
}));
|
})).catch(() => undefined);
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
Promise.all([device, deviceOptions]).then(function (responses) {
|
||||||
load(page, responses[0], responses[1]);
|
load(page, responses[0], responses[1]);
|
||||||
loading.hide();
|
loading.hide();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue