mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix implicit any TypeScript error
This commit is contained in:
parent
e30a252c8a
commit
57895e724c
23 changed files with 72 additions and 48 deletions
|
@ -1,3 +1,4 @@
|
|||
import { UserDto } from '@thornbill/jellyfin-sdk/dist/generated-client';
|
||||
import React, { FunctionComponent, useCallback, useEffect, useState, useRef } from 'react';
|
||||
|
||||
import loading from '../loading/loading';
|
||||
|
@ -26,7 +27,7 @@ const UserLibraryAccessPage: FunctionComponent = () => {
|
|||
|
||||
const element = useRef(null);
|
||||
|
||||
const triggerChange = (select) => {
|
||||
const triggerChange = (select: HTMLInputElement) => {
|
||||
const evt = document.createEvent('HTMLEvents');
|
||||
evt.initEvent('change', false, true);
|
||||
select.dispatchEvent(evt);
|
||||
|
@ -131,7 +132,7 @@ const UserLibraryAccessPage: FunctionComponent = () => {
|
|||
useEffect(() => {
|
||||
loadData();
|
||||
|
||||
const onSubmit = (e) => {
|
||||
const onSubmit = (e: Event) => {
|
||||
loading.show();
|
||||
const userId = appRouter.param('userId');
|
||||
window.ApiClient.getUser(userId).then(function (result) {
|
||||
|
@ -142,7 +143,15 @@ const UserLibraryAccessPage: FunctionComponent = () => {
|
|||
return false;
|
||||
};
|
||||
|
||||
const saveUser = (user) => {
|
||||
const saveUser = (user: UserDto) => {
|
||||
if (!user.Id) {
|
||||
throw new Error('Unexpected null user.Id');
|
||||
}
|
||||
|
||||
if (!user.Policy) {
|
||||
throw new Error('Unexpected null user.Policy');
|
||||
}
|
||||
|
||||
user.Policy.EnableAllFolders = element?.current?.querySelector('.chkEnableAllFolders').checked;
|
||||
user.Policy.EnabledFolders = user.Policy.EnableAllFolders ? [] : Array.prototype.filter.call(element?.current?.querySelectorAll('.chkFolder'), function (c) {
|
||||
return c.checked;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue