mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Use react-query for UserViews queries
This commit is contained in:
parent
f8719b8c5a
commit
92358de0b6
8 changed files with 196 additions and 89 deletions
|
@ -1,6 +1,10 @@
|
|||
import escapeHtml from 'escape-html';
|
||||
import Headroom from 'headroom.js';
|
||||
|
||||
import { getUserViewsQuery } from 'hooks/useUserViews';
|
||||
import { toApi } from 'utils/jellyfin-apiclient/compat';
|
||||
import { queryClient } from 'utils/query/queryClient';
|
||||
|
||||
import dom from './dom';
|
||||
import layoutManager from '../components/layoutManager';
|
||||
import inputManager from './inputManager';
|
||||
|
@ -383,28 +387,30 @@ function onSidebarLinkClick() {
|
|||
}
|
||||
|
||||
function getUserViews(apiClient, userId) {
|
||||
return apiClient.getUserViews({}, userId).then(function (result) {
|
||||
const items = result.Items;
|
||||
const list = [];
|
||||
return queryClient
|
||||
.fetchQuery(getUserViewsQuery(toApi(apiClient), userId))
|
||||
.then(function (result) {
|
||||
const items = result.Items;
|
||||
const list = [];
|
||||
|
||||
for (let i = 0, length = items.length; i < length; i++) {
|
||||
const view = items[i];
|
||||
list.push(view);
|
||||
for (let i = 0, length = items.length; i < length; i++) {
|
||||
const view = items[i];
|
||||
list.push(view);
|
||||
|
||||
if (view.CollectionType == 'livetv') {
|
||||
view.ImageTags = {};
|
||||
view.icon = 'live_tv';
|
||||
const guideView = Object.assign({}, view);
|
||||
guideView.Name = globalize.translate('Guide');
|
||||
guideView.ImageTags = {};
|
||||
guideView.icon = 'dvr';
|
||||
guideView.url = '#/livetv.html?tab=1';
|
||||
list.push(guideView);
|
||||
if (view.CollectionType == 'livetv') {
|
||||
view.ImageTags = {};
|
||||
view.icon = 'live_tv';
|
||||
const guideView = Object.assign({}, view);
|
||||
guideView.Name = globalize.translate('Guide');
|
||||
guideView.ImageTags = {};
|
||||
guideView.icon = 'dvr';
|
||||
guideView.url = '#/livetv.html?tab=1';
|
||||
list.push(guideView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
});
|
||||
return list;
|
||||
});
|
||||
}
|
||||
|
||||
function showBySelector(selector, show) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue