mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
Request-a-copy: Show correct preview link
Preview link was showing old URL path in grant access form
This commit is contained in:
@@ -52,21 +52,6 @@ export function getBitstreamDownloadWithAccessTokenRoute(bitstream, accessToken)
|
|||||||
}
|
}
|
||||||
return options;
|
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';
|
export const COAR_NOTIFY_SUPPORT = 'coar-notify-support';
|
||||||
|
|
||||||
@@ -163,11 +148,6 @@ export function getRequestCopyModulePath() {
|
|||||||
return `/${REQUEST_COPY_MODULE_PATH}`;
|
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 HEALTH_PAGE_PATH = 'health';
|
||||||
|
|
||||||
export const SUBSCRIPTIONS_MODULE_PATH = 'subscriptions';
|
export const SUBSCRIPTIONS_MODULE_PATH = 'subscriptions';
|
||||||
|
@@ -24,7 +24,6 @@ import {
|
|||||||
tap,
|
tap,
|
||||||
} from 'rxjs/operators';
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
import { getAccessTokenRequestRoute } from '../../app-routing-paths';
|
|
||||||
import { AuthService } from '../../core/auth/auth.service';
|
import { AuthService } from '../../core/auth/auth.service';
|
||||||
import { ItemRequestDataService } from '../../core/data/item-request-data.service';
|
import { ItemRequestDataService } from '../../core/data/item-request-data.service';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
@@ -35,6 +34,8 @@ import {
|
|||||||
getFirstCompletedRemoteData,
|
getFirstCompletedRemoteData,
|
||||||
getFirstSucceededRemoteDataPayload,
|
getFirstSucceededRemoteDataPayload,
|
||||||
} from '../../core/shared/operators';
|
} 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 { hasValue } from '../../shared/empty.util';
|
||||||
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
@@ -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
|
// and appropriately created a token to use with a secure link instead of attaching file directly
|
||||||
if (rd.hasSucceeded && hasValue(rd.payload.accessToken)) {
|
if (rd.hasSucceeded && hasValue(rd.payload.accessToken)) {
|
||||||
this.sendAsAttachment = false;
|
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.previewLink = this.hardRedirectService.getCurrentOrigin()
|
||||||
+ this.previewLinkOptions.routerLink + '?accessToken=' + rd.payload.accessToken;
|
+ this.previewLinkOptions.routerLink + '?accessToken=' + rd.payload.accessToken;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user