(core) Add org to FormAPI URL paths

Summary:
In some environments, URLs produced by FormAPI were missing an org, making them
ambiguous. This ensures that an org is always included in the path.

Test Plan: Manual.

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4200
pull/868/head
George Gevoian 7 months ago
parent c6fd79ac1f
commit 219b1f3f87

@ -1,5 +1,6 @@
import {BaseAPI, IOptions} from 'app/common/BaseAPI'; import {BaseAPI, IOptions} from 'app/common/BaseAPI';
import {CellValue, ColValues} from 'app/common/DocActions'; import {CellValue, ColValues} from 'app/common/DocActions';
import {addCurrentOrgToPath} from 'app/common/urlUtils';
/** /**
* Form and associated field metadata from a Grist view section. * Form and associated field metadata from a Grist view section.
@ -82,11 +83,8 @@ interface CreateRecordWithShareKeyOptions extends CreateRecordCommonOptions {
type CreateRecordOptions = CreateRecordWithDocIdOptions | CreateRecordWithShareKeyOptions; type CreateRecordOptions = CreateRecordWithDocIdOptions | CreateRecordWithShareKeyOptions;
export class FormAPIImpl extends BaseAPI implements FormAPI { export class FormAPIImpl extends BaseAPI implements FormAPI {
private _url: string; constructor(private _homeUrl: string, options: IOptions = {}) {
constructor(url: string, options: IOptions = {}) {
super(options); super(options);
this._url = url.replace(/\/$/, '');
} }
public async getForm(options: GetFormOptions): Promise<Form> { public async getForm(options: GetFormOptions): Promise<Form> {
@ -114,4 +112,8 @@ export class FormAPIImpl extends BaseAPI implements FormAPI {
}); });
} }
} }
private get _url(): string {
return addCurrentOrgToPath(this._homeUrl);
}
} }

Loading…
Cancel
Save