Revision 53735
Added by Konstantina Galouni over 5 years ago
edit-page-help-content.component.ts | ||
---|---|---|
9 | 9 |
import { ActivatedRoute, Router } from "@angular/router"; |
10 | 10 |
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; |
11 | 11 |
|
12 |
import {Session} from '../../openaireLibrary/login/utils/helper.class'; |
|
13 |
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class'; |
|
14 |
|
|
12 | 15 |
@Component({ |
13 | 16 |
selector: 'edit-page-help-content', |
14 | 17 |
templateUrl: 'edit-page-help-content.component.html', |
... | ... | |
69 | 72 |
} |
70 | 73 |
|
71 | 74 |
private getPageHelpContent(pageContentId: string) { |
72 |
this.showLoading = true; |
|
73 |
this.errorMessage = ""; |
|
74 |
this.updateErrorMessage = ""; |
|
75 |
if(!Session.isLoggedIn()){ |
|
76 |
console.info(this.router.url); |
|
77 |
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} }); |
|
78 |
} else { |
|
79 |
this.showLoading = true; |
|
80 |
this.errorMessage = ""; |
|
81 |
this.updateErrorMessage = ""; |
|
75 | 82 |
|
76 |
this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL).subscribe( |
|
77 |
pageHelpContent => { |
|
78 |
this.updateForm(pageHelpContent); |
|
79 |
this.showLoading = false; |
|
80 |
}, |
|
81 |
error => this.handleError('System error retrieving page help content', error)); |
|
83 |
this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL).subscribe( |
|
84 |
pageHelpContent => { |
|
85 |
this.updateForm(pageHelpContent); |
|
86 |
this.showLoading = false; |
|
87 |
}, |
|
88 |
error => this.handleError('System error retrieving page help content', error)); |
|
89 |
} |
|
82 | 90 |
} |
83 | 91 |
|
84 | 92 |
private updateForm(pageHelpContent : PageHelpContent) { |
... | ... | |
89 | 97 |
} |
90 | 98 |
|
91 | 99 |
private saveCustom() { |
100 |
if(!Session.isLoggedIn()){ |
|
101 |
console.info(this.router.url); |
|
102 |
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} }); |
|
103 |
} else { |
|
92 | 104 |
if(this.formComponent.myForm.valid) { |
93 | 105 |
this.showLoading = true; |
94 | 106 |
this.updateErrorMessage = ""; |
... | ... | |
109 | 121 |
} else { |
110 | 122 |
this.errorMessage = "Please fill all required fields"; |
111 | 123 |
} |
124 |
} |
|
112 | 125 |
} |
113 | 126 |
|
114 | 127 |
private cancelCustom() { |
Also available in: Unified diff
For every page: when Session is expired, redirect to '/user-info' page to show a proper message.