bms-repository/shared/client-api
pfych 0029086b3f
Some checks failed
Build & Lint / build-lint (push) Failing after 2m10s
Deploy / setup (push) Failing after 1m3s
Init
2024-10-12 14:08:09 +11:00
..
.eslintrc.js Init 2024-10-12 14:08:09 +11:00
admin.ts Init 2024-10-12 14:08:09 +11:00
chart.ts Init 2024-10-12 14:08:09 +11:00
package.json Init 2024-10-12 14:08:09 +11:00
README.md Init 2024-10-12 14:08:09 +11:00
request-handler.ts Init 2024-10-12 14:08:09 +11:00

Client API

A client side library intended to be used in multiple clients, such as admin, web and mobile. It handles authenticated and un-authenticated requests to the projects API.

Type Naming

Consider naming after the group of API endpoints, such as Admin, for all admin API requests.

Working With Baseblocks

New api endpoints may be manually added to this folder. A Baseblock may also add new API files during its installation.

Using Client API in a Client

Add a new "include" to the client tsconfig.json (e.g. packages/web/tsconfig.json)

"include": ["../shared/client-api"]

Add a new dependency to the client package.json (e.g. packages/web/package.json)

"@baseline/client-api": "1.0.0",

Referencing the client api in code

import { createAdmin } from '@baseline/client-api/admin';

If you are having issues with your IDE showing this package as not existing attempt restarting your IDE TS Server and IDE ESLint Server.

Note on Amplify

Since the package uses Amplify Auth for handling requests the same version must match all client versions or you will find that API requests will have authentication issues.

Confirm aws-amplify version in package.json is the same as the client package.json.