-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented pending action delete-account (#12508)
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
components/badger_maps/actions/delete-account/delete-account.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import app from "../../badger_maps.app.mjs"; | ||
|
||
export default { | ||
key: "badger_maps-delete-account", | ||
name: "Delete Account", | ||
description: "Deletes an account. [See the docs](https://badgerupdatedapi.docs.apiary.io/#reference/accounts/retrieve-and-update-account-details/delete-customer).", | ||
type: "action", | ||
version: "0.0.1", | ||
props: { | ||
app, | ||
accountId: { | ||
propDefinition: [ | ||
app, | ||
"accountId", | ||
], | ||
}, | ||
}, | ||
methods: { | ||
deleteAccount({ | ||
accountId, ...args | ||
} = {}) { | ||
return this.app.delete({ | ||
path: `/customers/${accountId}/`, | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $: step }) { | ||
const { | ||
deleteAccount, | ||
accountId, | ||
} = this; | ||
|
||
const response = await deleteAccount({ | ||
step, | ||
accountId, | ||
}); | ||
|
||
step.export("$summary", `Successfully deleted account with ID ${accountId}.`); | ||
|
||
return response || { | ||
success: true, | ||
}; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters