forked from sombochea/verdaccio-ui
222ffed022
* fix: package list refresh based on logged-in user description: In `pages/home/Home.tsx` now monitoring any change in a user log-in/out which will trigger a new `API.request` to get the _packages_ from the Verdaccio-server. This is done by creating a `useEffect` on **isUserLoggedIn**. Code has been transplanted from `App/App.tsx` including the use of the Loading component during the XHR. The use of **packages** was removed from other components as no longer needed and tests updated. Resolves issue #414 * fix: package list refresh based on logged-in user description: In `pages/home/Home.tsx` now monitoring any change in a user log-in/out which will trigger a new `API.request` to get the _packages_ from the Verdaccio-server. This is done by creating a `useEffect` on **isUserLoggedIn**. Code has been transplanted from `App/App.tsx` including the use of the Loading component during the XHR. The use of **packages** was removed from other components as no longer needed and tests updated. Test snapshots updated Resolves issue #414 Co-authored-by: Juan Picado @jotadeveloper <juanpicado19@gmail.com>
19 lines
341 B
TypeScript
19 lines
341 B
TypeScript
import { createContext } from 'react';
|
|
|
|
export interface AppProps {
|
|
user?: User;
|
|
scope: string;
|
|
}
|
|
|
|
export interface User {
|
|
username: string;
|
|
}
|
|
|
|
export interface AppContextProps extends AppProps {
|
|
setUser: (user?: User) => void;
|
|
}
|
|
|
|
const AppContext = createContext<undefined | AppContextProps>(undefined);
|
|
|
|
export default AppContext;
|