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:
parent
f20ceb4274
commit
d297f23932
8 changed files with 124 additions and 22 deletions
5
src/hooks/useApi.ts
Normal file
5
src/hooks/useApi.ts
Normal 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
5
src/hooks/useUser.ts
Normal 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);
|
Loading…
Add table
Add a link
Reference in a new issue