How to use the formiojs.Formio.setBaseUrl function in formiojs

To help you get started, we’ve selected a few formiojs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github formio / angular-formio / src / resource / resource.service.ts View on Github external
init() {
    if (this.initialized) {
      return;
    }
    this.initialized = true;
    if (this.appConfig && this.appConfig.appUrl) {
      Formio.setBaseUrl(this.appConfig.apiUrl);
      Formio.setProjectUrl(this.appConfig.appUrl);
      Formio.formOnly = this.appConfig.formOnly;
    } else {
      console.error('You must provide an AppConfig within your application!');
    }

    // Create the form url and load the resources.
    this.formUrl = this.appConfig.appUrl + '/' + this.config.form;
    this.resource = { data: {} };

    // Add this resource service to the list of all resources in context.
    if (this.resourcesService) {
      this.resources = this.resourcesService.resources;
      this.resources[this.config.name] = this;
    }
github formio / angular-formio / src / components / formio / formio.component.ts View on Github external
constructor(
    public ngZone: NgZone,
    public loader: FormioLoader,
    @Optional() public config: FormioAppConfig,
    @Optional() public customTags?: CustomTagsService,
  ) {
    super(ngZone, loader, config, customTags);
    if (this.config) {
      Formio.setBaseUrl(this.config.apiUrl);
      Formio.setProjectUrl(this.config.appUrl);
    } else {
      console.warn('You must provide an AppConfig within your application!');
    }
  }
github formio / angular-formio / src / auth / auth.service.ts View on Github external
constructor(
    public appConfig: FormioAppConfig,
    public config: FormioAuthConfig
  ) {
    this.user = null;

    if (this.appConfig && this.appConfig.appUrl) {
      Formio.setBaseUrl(this.appConfig.apiUrl);
      Formio.setProjectUrl(this.appConfig.appUrl);
      Formio.formOnly = !!this.appConfig.formOnly;
    } else {
      console.error('You must provide an AppConfig within your application!');
    }

    this.loginForm =
      this.appConfig.appUrl +
      '/' +
      get(this.config, 'login.form', 'user/login');
    this.registerForm =
      this.appConfig.appUrl +
      '/' +
      get(this.config, 'register.form', 'user/register');
    this.onLogin = new EventEmitter();
    this.onLogout = new EventEmitter();
github formio / angular-formio / src / components / formbuilder / formbuilder.component.ts View on Github external
constructor(
    private ngZone: NgZone,
    @Optional() private config: FormioAppConfig,
    @Optional() private customTags?: CustomTagsService
  ) {
    if (this.config) {
      Formio.setBaseUrl(this.config.apiUrl);
      Formio.setProjectUrl(this.config.appUrl);
    } else {
      console.warn('You must provide an AppConfig within your application!');
    }

    this.change = new EventEmitter();
    this.ready = new Promise((resolve: any) => {
      this.readyResolve = resolve;
    });
  }
github formio / angular-formio / src / manager / form-manager.service.ts View on Github external
constructor(
    public appConfig: FormioAppConfig,
    public config: FormManagerConfig,
    public auth: FormioAuthService
  ) {
    if (this.appConfig && this.appConfig.appUrl) {
      Formio.setBaseUrl(this.appConfig.apiUrl);
      Formio.setProjectUrl(this.appConfig.appUrl);
    } else {
      console.error('You must provide an AppConfig within your application!');
    }

    this.allAccessMap = {
      'update_all': 'formEdit',
      'delete_all': 'formDelete'
    };
    this.ownAccessMap = {
      'update_own': 'formEdit',
      'delete_own': 'formDelete'
    };
    this.actionAllowed = (action) => this.isActionAllowed(action);
    this.reset();
  }