mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 05:53:03 +00:00

Conflicts: src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.ts src/app/+community-page/community-page.component.html src/app/app.reducer.ts src/app/core/auth/server-auth.service.ts src/app/core/core.module.ts src/app/core/data/item-data.service.spec.ts src/app/core/data/item-data.service.ts src/app/core/index/index.effects.ts src/app/core/index/index.reducer.spec.ts src/app/core/index/index.reducer.ts src/app/core/shared/operators.spec.ts src/app/core/shared/operators.ts src/app/header/header.component.spec.ts
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import {Component} from '@angular/core';
|
|
import {first} from 'rxjs/operators';
|
|
import {AbstractSimpleItemActionComponent} from '../simple-item-action/abstract-simple-item-action.component';
|
|
import {RemoteData} from '../../../core/data/remote-data';
|
|
import {Item} from '../../../core/shared/item.model';
|
|
import { RestResponse } from '../../../core/cache/response.models';
|
|
|
|
@Component({
|
|
selector: 'ds-item-withdraw',
|
|
templateUrl: '../simple-item-action/abstract-simple-item-action.component.html'
|
|
})
|
|
/**
|
|
* Component responsible for rendering the Item Withdraw page
|
|
*/
|
|
export class ItemWithdrawComponent extends AbstractSimpleItemActionComponent {
|
|
|
|
protected messageKey = 'withdraw';
|
|
protected predicate = (rd: RemoteData<Item>) => rd.payload.isWithdrawn;
|
|
|
|
/**
|
|
* Perform the withdraw action to the item
|
|
*/
|
|
performAction() {
|
|
this.itemDataService.setWithDrawn(this.item.id, true).pipe(first()).subscribe(
|
|
(response: RestResponse) => {
|
|
this.processRestResponse(response);
|
|
}
|
|
);
|
|
}
|
|
}
|