diff --git a/src/custom-functions/v3/bcode.ts b/src/custom-functions/v3/bcode.ts index 1f8e030..9982f97 100644 --- a/src/custom-functions/v3/bcode.ts +++ b/src/custom-functions/v3/bcode.ts @@ -29,8 +29,12 @@ export function bcode( } const setting = Setting.load() - if (!setting.token) { - throw new Error('<>') + if (setting.token === null) { + throw new Error('<>') + } + + if (setting.token === '') { + throw new Error('<>') } if (typeof intent === 'string' && intent.toUpperCase() === Setting.companyIntent) { diff --git a/src/setting.ts b/src/setting.ts index a25dea6..d62da2b 100644 --- a/src/setting.ts +++ b/src/setting.ts @@ -15,12 +15,12 @@ export class Setting { static readonly companyIntent = 'COMPANY' private constructor( - private _token: string, + private _token: string | null, private _ondemandApiEnabled: boolean, private _ondemandApiCallMode: 'default' | 'force' ) {} - public get token(): string { + public get token(): string | null { return this._token }