mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add eslint rules for sonar issues
This commit is contained in:
parent
2690b90d84
commit
19f416580c
12 changed files with 45 additions and 30 deletions
|
@ -1,7 +1,7 @@
|
|||
import type { Api } from '@jellyfin/sdk';
|
||||
import type { UserDto } from '@jellyfin/sdk/lib/generated-client';
|
||||
import type { ApiClient, Event } from 'jellyfin-apiclient';
|
||||
import React, { createContext, FC, useContext, useEffect, useState } from 'react';
|
||||
import React, { createContext, FC, useContext, useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import ServerConnections from '../components/ServerConnections';
|
||||
import events from '../utils/events';
|
||||
|
@ -21,6 +21,12 @@ export const ApiProvider: FC = ({ children }) => {
|
|||
const [ api, setApi ] = useState<Api>();
|
||||
const [ user, setUser ] = useState<UserDto>();
|
||||
|
||||
const context = useMemo(() => ({
|
||||
__legacyApiClient__: legacyApiClient,
|
||||
api,
|
||||
user
|
||||
}), [ api, legacyApiClient, user ]);
|
||||
|
||||
useEffect(() => {
|
||||
ServerConnections.currentApiClient()
|
||||
?.getCurrentUser()
|
||||
|
@ -56,11 +62,7 @@ export const ApiProvider: FC = ({ children }) => {
|
|||
}, [ legacyApiClient, setApi ]);
|
||||
|
||||
return (
|
||||
<ApiContext.Provider value={{
|
||||
__legacyApiClient__: legacyApiClient,
|
||||
api,
|
||||
user
|
||||
}}>
|
||||
<ApiContext.Provider value={context}>
|
||||
{children}
|
||||
</ApiContext.Provider>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue