Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function FormioAuthService(appConfig, config) {
var _this = this;
this.appConfig = appConfig;
this.config = config;
this.authenticated = false;
this.formAccess = {};
this.submissionAccess = {};
this.is = {};
this.user = null;
if (this.appConfig && this.appConfig.appUrl) {
Formio.setBaseUrl(this.appConfig.apiUrl);
Formio.setAppUrl(this.appConfig.appUrl);
Formio.formOnly = !!this.appConfig.formOnly;
}
else {
console.error('You must provide an AppConfig within your application!');
}
this.loginForm = this.appConfig.appUrl + '/' + this.config.login.form;
this.registerForm = this.appConfig.appUrl + '/' + this.config.register.form;
this.onLogin = new core_1.EventEmitter();
this.onLogout = new core_1.EventEmitter();
this.onRegister = new core_1.EventEmitter();
this.onUser = new core_1.EventEmitter();
this.onError = new core_1.EventEmitter();
this.ready = new Promise(function (resolve, reject) {
_this.readyResolve = resolve;
_this.readyReject = reject;
});
// Register for the core events.
function FormioResourceService(appConfig, config, loader, resourcesService) {
var _this = this;
this.appConfig = appConfig;
this.config = config;
this.loader = loader;
this.resourcesService = resourcesService;
if (this.appConfig && this.appConfig.appUrl) {
Formio.setBaseUrl(this.appConfig.apiUrl);
Formio.setAppUrl(this.appConfig.appUrl);
Formio.formOnly = this.appConfig.formOnly;
}
else {
console.error('You must provide an AppConfig within your application!');
}
// Add this resource service to the list of all resources in context.
if (this.resourcesService) {
this.resourcesService.resources[this.config.name] = this;
this.resources = this.resourcesService.resources;
}
// Create the form url and load the resources.
this.formUrl = this.appConfig.appUrl + '/' + this.config.form;
this.onParents = new core_1.EventEmitter();
this.onIndexSelect = new core_1.EventEmitter();
this.refresh = new core_1.EventEmitter();
this.resource = { data: {} };
this.resourceLoaded = new Promise(function (resolve, reject) {
constructor(
public appConfig: FormioAppConfig,
public config: FormioResourceConfig,
public loader: FormioLoader,
@Optional() public resourcesService: FormioResources
) {
if (this.appConfig && this.appConfig.appUrl) {
Formio.setBaseUrl(this.appConfig.apiUrl);
Formio.setAppUrl(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.initialize();
}
constructor(
public appConfig: FormioAppConfig,
public config: FormioAuthConfig
) {
this.user = null;
if (this.appConfig && this.appConfig.appUrl) {
Formio.setBaseUrl(this.appConfig.apiUrl);
Formio.setAppUrl(this.appConfig.appUrl);
Formio.formOnly = !!this.appConfig.formOnly;
}
else {
console.error('You must provide an AppConfig within your application!');
}
this.loginForm = this.appConfig.appUrl + '/' + this.config.login.form;
this.registerForm = this.appConfig.appUrl + '/' + this.config.register.form;
this.onLogin = new EventEmitter();
this.onLogout = new EventEmitter();
this.onRegister = new EventEmitter();
this.onUser = new EventEmitter();
this.onError = new EventEmitter();
this.ready = new Promise((resolve: any, reject: any) => {
this.readyResolve = resolve;
this.readyReject = reject;