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

Add api and user contexts

This commit is contained in:
Bill Thornton 2022-10-28 01:09:59 -04:00
parent f20ceb4274
commit d297f23932
8 changed files with 124 additions and 22 deletions

5
src/hooks/useApi.ts Normal file
View file

@ -0,0 +1,5 @@
import { Api } from '@jellyfin/sdk';
import { createContext, useContext } from 'react';
export const ApiContext = createContext<Api | undefined>(undefined);
export const useApi = () => useContext(ApiContext);

5
src/hooks/useUser.ts Normal file
View file

@ -0,0 +1,5 @@
import { UserDto } from '@jellyfin/sdk/lib/generated-client/models/user-dto';
import { createContext, useContext } from 'react';
export const UserContext = createContext<UserDto | undefined>(undefined);
export const useUser = () => useContext(UserContext);