@robotbas/robotcloud-client
v0.2.8
Published
RobotCloud API client
Maintainers
Readme
TYPESCRIPT ROBOTCLOUD API CLIENT
Typescript library to access robotcloud endpoints.
Installation
yarn add @robotbas/robotcloud-clientConfigure authentication interceptor
Example used on a nuxtjs middleware to setup the RobotCloud API token.
import { clientConfig } from "@robotbas/robotcloud-client";
const appConfigs = useRuntimeConfig().public; // Get aplication global configs
// Configure Robotcloud API
clientConfig.baseURL = appConfigs.robotcloudUrl
clientConfig.checkToken = async () => {
const token = await checkToken()
if (!token) {
await navigateTo(appConfigs.loginUrl, { external: true })
return ''
}
return token
}
clientConfig.tokenMinutesBeforeExpirationRenew = 10
