1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

fixed some code smells

fix config.json plugins path
This commit is contained in:
vitorsemeano 2020-10-22 00:36:38 +01:00
parent 327462321c
commit 6638c13e85
8 changed files with 41 additions and 39 deletions

View file

@ -1856,10 +1856,14 @@ function onTrackSelectionsSubmit(e) {
window.ItemDetailPage = new itemDetailPage();
export default function (view, params) {
function getApiClient() {
return params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient;
}
function reload(instance, page, params) {
loading.show();
const apiClient = params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient;
const apiClient = getApiClient();
Promise.all([getPromise(apiClient, params), apiClient.getCurrentUser()]).then(([item, user]) => {
currentItem = item;
@ -1955,7 +1959,7 @@ export default function (view, params) {
function onDownloadClick() {
import('../../scripts/fileDownloader').then(({ default: fileDownloader }) => {
const downloadHref = apiClient.getItemDownloadUrl(currentItem.Id);
const downloadHref = getApiClient().getItemDownloadUrl(currentItem.Id);
fileDownloader.download([{
url: downloadHref,
itemId: currentItem.Id,
@ -1968,6 +1972,8 @@ export default function (view, params) {
const button = this;
let selectedItem = view.querySelector('.selectSource').value || currentItem.Id;
const apiClient = getApiClient();
apiClient.getItem(apiClient.getCurrentUserId(), selectedItem).then(function (item) {
selectedItem = item;
@ -2007,7 +2013,7 @@ export default function (view, params) {
let currentItem;
const self = this;
const apiClient = params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient;
const apiClient = getApiClient();
const btnResume = view.querySelector('.mainDetailButtons .btnResume');
const btnPlay = view.querySelector('.mainDetailButtons .btnPlay');

View file

@ -1335,9 +1335,7 @@ import { appRouter } from '../../../components/appRouter';
passive: true
});
} catch (e) {
import('../../../components/appRouter').then(({default: appRouter}) => {
appRouter.goHome();
});
appRouter.goHome();
}
});
view.addEventListener('viewbeforehide', function () {