diff --git a/dashboard/divhelpcontent/class-help-contents.component.ts b/dashboard/divhelpcontent/class-help-contents.component.ts
index 739c0faf..00972059 100644
--- a/dashboard/divhelpcontent/class-help-contents.component.ts
+++ b/dashboard/divhelpcontent/class-help-contents.component.ts
@@ -192,31 +192,22 @@ export class ClassHelpContentsComponent implements OnInit {
}
public togglePageHelpContents(status: boolean, ids: string[]) {
- if (!Session.isLoggedIn()) {
- this.router.navigate(['/user-info'], {
- queryParams: {
- 'errorCode': LoginErrorCodes.NOT_VALID,
- 'redirectUrl': this.router.url
+ this.subscriptions.push(this._helpService.toggleDivHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe(
+ () => {
+ for (let id of ids) {
+ let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
+ this.checkboxes[i].divHelpContent.isActive = status;
}
- });
- } else {
- this.subscriptions.push(this._helpService.toggleDivHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe(
- () => {
- for (let id of ids) {
- let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
- this.checkboxes[i].divHelpContent.isActive = status;
- }
- this.countClassHelpContents();
- this.applyCheck(false);
- UIkit.notification('Page content(s) has been successfully updated', {
- status: 'success',
- timeout: 6000,
- pos: 'bottom-right'
- });
- },
- error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
- ));
- }
+ this.countClassHelpContents();
+ this.applyCheck(false);
+ UIkit.notification('Page content(s) has been successfully updated', {
+ status: 'success',
+ timeout: 6000,
+ pos: 'bottom-right'
+ });
+ },
+ error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
+ ));
}
diff --git a/dashboard/portal/portals.component.ts b/dashboard/portal/portals.component.ts
index 674056bc..acd1dd09 100644
--- a/dashboard/portal/portals.component.ts
+++ b/dashboard/portal/portals.component.ts
@@ -81,24 +81,18 @@ export class PortalsComponent implements OnInit {
}
getPortals() {
- if (!Session.isLoggedIn()) {
- this._router.navigate(['/user-info'], {
- queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}
- });
- } else {
- this.showLoading = true;
- this.subscriptions.push(this._helpContentService.getPortalsFull(this.properties.adminToolsAPIURL).subscribe(
- portals => {
- this.portals = portals;
- if (portals) {
- portals.forEach(_ => {
- this.checkboxes.push({portal: _, checked: false});
- });
- }
- this.showLoading = false;
- },
- error => this.handleError('System error retrieving portals', error)));
- }
+ this.showLoading = true;
+ this.subscriptions.push(this._helpContentService.getPortalsFull(this.properties.adminToolsAPIURL).subscribe(
+ portals => {
+ this.portals = portals;
+ if (portals) {
+ portals.forEach(_ => {
+ this.checkboxes.push({portal: _, checked: false});
+ });
+ }
+ this.showLoading = false;
+ },
+ error => this.handleError('System error retrieving portals', error)));
}
public toggleCheckBoxes(event) {
@@ -187,59 +181,41 @@ export class PortalsComponent implements OnInit {
}
private portalModalOpen(title: string, yesBtn: string) {
- if (!Session.isLoggedIn()) {
- this._router.navigate(['/user-info'], {
- queryParams: {
- "errorCode": LoginErrorCodes.NOT_VALID,
- "redirectUrl": this._router.url
- }
- });
- } else {
- this.editModal.okButtonLeft = false;
- this.editModal.alertTitle = title;
- this.editModal.okButtonText = yesBtn;
- this.editModal.open();
- }
+ this.editModal.okButtonLeft = false;
+ this.editModal.alertTitle = title;
+ this.editModal.okButtonText = yesBtn;
+ this.editModal.open();
}
public portalSaveConfirmed(data: any) {
this.showLoading = true;
- if (!Session.isLoggedIn()) {
- this._router.navigate(['/user-info'], {
- queryParams: {
- "errorCode": LoginErrorCodes.NOT_VALID,
- "redirectUrl": this._router.url
- }
- });
+ if (this.portalForm.value._id) {
+ this.portalForm.get('type').enable();
+ this.subscriptions.push(this._helpContentService.updateCommunity(this.portalForm.value,
+ this.properties.adminToolsAPIURL).subscribe(
+ portal => {
+ this.portalUpdatedSuccessfully(portal);
+ UIkit.notification('Portal ' + portal.name + ' has been successfully updated', {
+ status: 'success',
+ timeout: 6000,
+ pos: 'bottom-right'
+ });
+ },
+ error => this.handleUpdateError('System error updating portal', error)
+ ));
} else {
- if (this.portalForm.value._id) {
- this.portalForm.get('type').enable();
- this.subscriptions.push(this._helpContentService.updateCommunity(this.portalForm.value,
- this.properties.adminToolsAPIURL).subscribe(
- portal => {
- this.portalUpdatedSuccessfully(portal);
- UIkit.notification('Portal ' + portal.name + ' has been successfully updated', {
- status: 'success',
- timeout: 6000,
- pos: 'bottom-right'
- });
- },
- error => this.handleUpdateError('System error updating portal', error)
- ));
- } else {
- this.subscriptions.push(this._helpContentService.saveCommunity(this.portalForm.value,
- this.properties.adminToolsAPIURL).subscribe(
- portal => {
- this.portalSavedSuccessfully(portal);
- UIkit.notification('Portal ' + portal.name + ' has been successfully created', {
- status: 'success',
- timeout: 6000,
- pos: 'bottom-right'
- });
- },
- error => this.handleUpdateError('System error creating portal', error)
- ));
- }
+ this.subscriptions.push(this._helpContentService.saveCommunity(this.portalForm.value,
+ this.properties.adminToolsAPIURL).subscribe(
+ portal => {
+ this.portalSavedSuccessfully(portal);
+ UIkit.notification('Portal ' + portal.name + ' has been successfully created', {
+ status: 'success',
+ timeout: 6000,
+ pos: 'bottom-right'
+ });
+ },
+ error => this.handleUpdateError('System error creating portal', error)
+ ));
}
}