# Novox Photos manager ## Client - Photos react app ### App structure - React application with a public facing website (`./public`) and an administration panel (`./private`) - React router is split into `` and `` - `` is wrapped in the `` context provider - The `` context provider is created using the `AuthProvider` from the [`oidc-react`](https://github.com/bjerkio/oidc-react) package - AutoSignin is explicitly set to `false` to prevent the website from always trying to log in (even if not trying to access the admin section) - The `` component handles the authentication only rendering the `` when the user is logged in and has sufficient permissions (role based) - We can access the user info using the `useAuth` hook, only possible in React components or hooks - Our `privateApi` service is provided using the `usePrivateApi` hook, it makes use of the `useAuth` hook to set the authorization header - The url for the private api is set using a "environment variable" (see build process) ### Build process - The build process is quite simple and uses `react-scripts build` - "Environment variables" can be set in the `.env` file. Before starting the application run `./scripts/env.sh` to create an `env-config.js` file in the`./public` folder which is then loaded using a `