Files
threshold-ui/addons/core/addon/components/pending-confirmations/index.js
T
Lisbet Alvarez 3ba93927fe Update copyright headers (#3146)
* empty commit

* Add missing copyright headers

* chore: 🤖 update copywrite config file with correct year

* Add missing copyright headers

* empty commit (gh action merge checks are stuck)
2026-01-28 17:09:06 -08:00

44 lines
988 B
JavaScript

/**
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
import Component from '@glimmer/component';
import { service } from '@ember/service';
import { action } from '@ember/object';
/**
* A component that yields for each pending confirmation in the confirmations
* service, passing the confirmation instance, a confirm action, and a dismiss
* action. Useful for rendering confirm modals and awaiting user action.
*/
export default class PendingConfirmationsComponent extends Component {
// =services
@service confirm;
// =actions
/**
* Accepts the passed confirmation.
* @param {Confirmation} confirmation
* @return {Confirmation}
*/
@action
accept(confirmation) {
confirmation.confirm();
return confirmation;
}
/**
* Denies the passed confirmation.
* @param {Confirmation} confirmation
* @return {Confirmation}
*/
@action
deny(confirmation) {
confirmation.dismiss();
return confirmation;
}
}