Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/app/app-routing-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,6 @@ export function getBitstreamDownloadWithAccessTokenRoute(bitstream, accessToken)
}
return options;
}
/**
* Get an access token request route for a user to access approved bitstreams using a supplied access token
* @param item_uuid item UUID
* @param accessToken access token (generated by backend)
*/
export function getAccessTokenRequestRoute(item_uuid, accessToken): { routerLink: string, queryParams: any } {
const url = new URLCombiner(getItemModuleRoute(), item_uuid, getAccessByTokenModulePath()).toString();
const options = {
routerLink: url,
queryParams: {
accessToken: (hasValue(accessToken) ? accessToken : undefined),
},
};
return options;
}

export const COAR_NOTIFY_SUPPORT = 'coar-notify-support';

Expand Down Expand Up @@ -163,11 +148,6 @@ export function getRequestCopyModulePath() {
return `/${REQUEST_COPY_MODULE_PATH}`;
}

export const ACCESS_BY_TOKEN_MODULE_PATH = 'access-by-token';
export function getAccessByTokenModulePath() {
return `/${ACCESS_BY_TOKEN_MODULE_PATH}`;
}

export const HEALTH_PAGE_PATH = 'health';

export const SUBSCRIPTIONS_MODULE_PATH = 'subscriptions';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
tap,
} from 'rxjs/operators';

import { getAccessTokenRequestRoute } from '../../app-routing-paths';
import { AuthService } from '../../core/auth/auth.service';
import { ItemRequestDataService } from '../../core/data/item-request-data.service';
import { RemoteData } from '../../core/data/remote-data';
Expand All @@ -35,6 +34,8 @@ import {
getFirstCompletedRemoteData,
getFirstSucceededRemoteDataPayload,
} from '../../core/shared/operators';
import { URLCombiner } from '../../core/url-combiner/url-combiner';
import { getItemModuleRoute } from '../../item-page/item-page-routing-paths';
import { hasValue } from '../../shared/empty.util';
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
import { NotificationsService } from '../../shared/notifications/notifications.service';
Expand Down Expand Up @@ -126,7 +127,12 @@ export class GrantRequestCopyComponent implements OnInit {
// and appropriately created a token to use with a secure link instead of attaching file directly
if (rd.hasSucceeded && hasValue(rd.payload.accessToken)) {
this.sendAsAttachment = false;
this.previewLinkOptions = getAccessTokenRequestRoute(rd.payload.itemId, rd.payload.accessToken);
this.previewLinkOptions = {
routerLink: new URLCombiner(getItemModuleRoute(), rd.payload.itemId).toString(),
queryParams: {
accessToken: rd.payload.accessToken,
},
};
this.previewLink = this.hardRedirectService.getCurrentOrigin()
+ this.previewLinkOptions.routerLink + '?accessToken=' + rd.payload.accessToken;
}
Expand Down
Loading