mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 23:13:04 +00:00
added JSON response, created new submission section
This commit is contained in:
@@ -60,6 +60,8 @@ export class SubmissionService {
|
||||
*/
|
||||
protected timer$: Observable<any>;
|
||||
|
||||
private workspaceLinkPath = 'workspaceitems';
|
||||
private workflowLinkPath = 'workflowitems';
|
||||
/**
|
||||
* Initialize service variables
|
||||
* @param {GlobalConfig} EnvConfig
|
||||
@@ -98,7 +100,7 @@ export class SubmissionService {
|
||||
* observable of SubmissionObject
|
||||
*/
|
||||
createSubmission(): Observable<SubmissionObject> {
|
||||
return this.restService.postToEndpoint('workspaceitems', {}).pipe(
|
||||
return this.restService.postToEndpoint(this.workspaceLinkPath, {}).pipe(
|
||||
map((workspaceitem: SubmissionObject) => workspaceitem[0]),
|
||||
catchError(() => observableOf({})))
|
||||
}
|
||||
@@ -116,7 +118,7 @@ export class SubmissionService {
|
||||
let headers = new HttpHeaders();
|
||||
headers = headers.append('Content-Type', 'text/uri-list');
|
||||
options.headers = headers;
|
||||
return this.restService.postToEndpoint('workflowitems', selfUrl, null, options) as Observable<SubmissionObject[]>;
|
||||
return this.restService.postToEndpoint(this.workspaceLinkPath, selfUrl, null, options) as Observable<SubmissionObject[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,9 +308,9 @@ export class SubmissionService {
|
||||
getSubmissionObjectLinkName(): string {
|
||||
const url = this.router.routerState.snapshot.url;
|
||||
if (url.startsWith('/workspaceitems') || url.startsWith('/submit')) {
|
||||
return 'workspaceitems';
|
||||
return this.workspaceLinkPath;
|
||||
} else if (url.startsWith('/workflowitems')) {
|
||||
return 'workflowitems';
|
||||
return this.workflowLinkPath;
|
||||
} else {
|
||||
return 'edititems';
|
||||
}
|
||||
@@ -323,10 +325,10 @@ export class SubmissionService {
|
||||
getSubmissionScope(): SubmissionScopeType {
|
||||
let scope: SubmissionScopeType;
|
||||
switch (this.getSubmissionObjectLinkName()) {
|
||||
case 'workspaceitems':
|
||||
case this.workspaceLinkPath:
|
||||
scope = SubmissionScopeType.WorkspaceItem;
|
||||
break;
|
||||
case 'workflowitems':
|
||||
case this.workflowLinkPath:
|
||||
scope = SubmissionScopeType.WorkflowItem;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user