[Library & Connect Admin | new-theme]: edit-community.component.ts & portals.component.ts & pages.component.ts & page-help-content-form.component.ts & page-help-contents.component.ts & entities.component.ts & divIds.component.ts & class-help-content-form.component.ts & class-help-contents.component.ts: On save/update/delete/toggle community/page/entity/divId/helptext/divHelptext , call clearCache() to immediately get changes in the dashboards.

This commit is contained in:
Konstantina Galouni 2022-07-12 16:50:56 +03:00
parent 6d68e753c6
commit b1515cd395
1 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import {StringUtils} from "../../../../openaireLibrary/utils/string-utils.class"
import {Subscription} from "rxjs";
import {Option} from "../../../../openaireLibrary/sharedComponents/input/input.component";
import {NotificationHandler} from "../../../../openaireLibrary/utils/notification-handler";
import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cache.service";
@Component({
selector: 'edit-community',
@ -111,7 +112,8 @@ export class EditCommunityComponent {
constructor(private fb: FormBuilder,
private communityService: CommunityService,
private utilsService: UtilitiesService,
private userManagementService: UserManagementService) {
private userManagementService: UserManagementService,
private _clearCacheService: ClearCacheService) {
}
ngOnDestroy() {
@ -211,6 +213,7 @@ export class EditCommunityComponent {
this.removePhoto();
this.subscriptions.push(this.communityService.updateCommunity(
this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => {
this._clearCacheService.clearCache("Community saved");
this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
NotificationHandler.rise(community.shortTitle + ' has been <b>successfully created</b>');
callback(community);
@ -223,6 +226,7 @@ export class EditCommunityComponent {
}));
} else {
this.subscriptions.push(this.communityService.updateCommunity(this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => {
this._clearCacheService.clearCache("Community updated");
this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
NotificationHandler.rise(community.shortTitle + ' has been <b>successfully saved</b>');
callback(community);