Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
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!');
}
}
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();
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;
});
}
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();
}