fix for onCallApiUrl not being set

This commit is contained in:
Rares Mardare 2022-09-22 13:46:22 +03:00
parent 1392994d26
commit ca95af4940
2 changed files with 8 additions and 3 deletions

View file

@ -100,14 +100,14 @@ const ApiTokenForm = observer((props: TokenCreationModalProps) => {
return (
<VerticalGroup>
<Label>Curl command example</Label>
<SourceCode showClipboardIconOnly>{getCurlExample(token)}</SourceCode>
<SourceCode showClipboardIconOnly>{getCurlExample(token, store.onCallApiUrl)}</SourceCode>
</VerticalGroup>
);
}
});
function getCurlExample(token) {
return `curl -H "Authorization: ${token}" ${getItem('onCallApiUrl')}/api/v1/integrations`;
function getCurlExample(token, onCallApiUrl) {
return `curl -H "Authorization: ${token}" ${onCallApiUrl}/api/v1/integrations`;
}
export default ApiTokenForm;

View file

@ -90,6 +90,9 @@ export class RootBaseStore {
@observable
incidentsPage: any = this.initialQuery.p ? Number(this.initialQuery.p) : 1;
@observable
onCallApiUrl: string;
// --------------------------
userStore: UserStore = new UserStore(this);
@ -187,6 +190,8 @@ export class RootBaseStore {
return;
}
this.onCallApiUrl = meta.jsonData.onCallApiUrl;
let syncStartStatus = await this.startSync();
if (syncStartStatus.is_user_anonymous) {
this.isUserAnonymous = true;