Clone the repository:
$ git clone [email protected]:Vaccine-Hunters-Canada/VaxFinder-Frontend.git
Optionally create a .env.local
file and define the path to the API server:
REACT_APP_API_URL=http://localhost:5000
Before beginning development, install the required packages by running yarn install
or npm i
.
Start the app in development mode at http://localhost:3000:
$ yarn start
Start the app in development mode with a mocked api at http://localhost:3000:
$ yarn start:mock-api
Generate TypeScript types and typesafe React hooks based off the OpenAPI schema:
$ yarn generate:api
This codebase uses ESLint to ensure code consistency, proper formatting and quality. Most major IDEs include an ESLint extension that will draw attention to linting issues. There are also usually settings in IDEs to fix linting issues automatically. For example, in VS Code, these settings are Format on Save
and Format on Paste
.
If an extension is not available to you, runnning yarn lint
will scan the codebase for linting violations.
$ yarn lint
Attempts to resolve certain linting violations where possible.
$ yarn lint:fix
Run tests in interactive watch mode:
$ yarn test
Builds the app for production to the build
folder:
$ yarn build
https://witty-ocean-02e42dd0f.azurestaticapps.net/
There appears to be a bug in restful-react
when it comes to generating members from OpenApi's anyOf
operator. At the time of writing, this gets written apiClient.ts
:
export interface VaccineAvailabilityTimeslotUpdateRequest {
time: string;
takenAt?: {};
}
This will produce an error:
Don't use
{}
as a type.{}
actually means "any non-nullish value".
When this happens, you will need to examine the OpenApi schema and determine what the appropriate type should be, and manually update apiClient.ts
Bug to track: contiamo/restful-react#317