Skip to content

Commit

Permalink
Merge pull request #17085 from opf/bug/58271-access-token-refresh-res…
Browse files Browse the repository at this point in the history
…ults-in-error-message-in-files-tab

[#58271] Access token refresh results in error message in files tab
  • Loading branch information
dominic-braeunlein authored Nov 5, 2024
2 parents c672fd9 + 20bff0e commit e04d659
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,6 @@ export class WorkPackageSingleViewBase extends UntilDestroyedMixin {
this.attachmentsResourceService.fetchCollection(this.workPackage.$links.attachments.href as string).subscribe();
}

if (this.workPackage.$links.fileLinks) {
this.fileLinkResourceService
.updateCollectionsForWorkPackage(this.workPackage.$links.fileLinks.href as string)
.pipe(take(1))
.subscribe(
() => { /* Do nothing */ },
(error:HttpErrorResponse) => { this.toastService.addError(error); },
);
}

// Listen to tab changes to update the tab label
this.keepTab.observable
.pipe(this.untilDestroyed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import { IHalResourceLink } from 'core-app/core/state/hal-resource';
import {
LocationPickerModalComponent,
} from 'core-app/shared/components/storages/location-picker-modal/location-picker-modal.component';
import { ToastService } from 'core-app/shared/components/toaster/toast.service';
import { IToast, ToastService } from 'core-app/shared/components/toaster/toast.service';
import { StorageFilesResourceService } from 'core-app/core/state/storage-files/storage-files.service';
import { IUploadFile, OpUploadService } from 'core-app/core/upload/upload.service';
import { IUploadLink } from 'core-app/core/state/storage-files/upload-link.model';
Expand Down Expand Up @@ -237,21 +237,27 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnD
ngOnInit():void {
this.storage = this.storagesResourceService.requireEntity(this.projectStorage._links.storage.href);

this.fileLinks = this.collectionKey()
.pipe(
switchMap((key) => {
if (isNewResource(this.resource)) {
return this.fileLinkResourceService.collection(key);
}
this.fileLinks = this.storage.pipe(
take(1),
switchMap(() =>
this.collectionKey().pipe(
switchMap((key) => {
if (isNewResource(this.resource)) {
return this.fileLinkResourceService.collection(key);
}
return this.fileLinkResourceService.requireCollection(key);
}),
tap((fileLinks) => {
if (isNewResource(this.resource)) {
this.resource.fileLinks = { elements: fileLinks.map((a) => a._links?.self) };
}
}),
)),
);

return this.fileLinkResourceService.requireCollection(key);
}),
tap((fileLinks) => {
if (isNewResource(this.resource)) {
this.resource.fileLinks = { elements: fileLinks.map((a) => a._links?.self) };
}
}),
);
this.fileLinks.subscribe({ error: (err:string | HttpErrorResponse | IToast) =>
this.toastService.addError(err),
});

this.disabled = combineLatest([
this.storage,
Expand Down

0 comments on commit e04d659

Please sign in to comment.