Skip to content

MutationTrigger type #2711

Answered by phryneas
vbelinschi asked this question in Q&A
Sep 21, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

My first thought would be

function handle(triggerResult: { unwrap(): Promise<any> }) {
  return triggerResult
  .unwrap()
 .then(() => {
  showSuccessNotification();
 })
 .catch((error) => {
  showErrorNotification(error);
 });
}

to be used as

 await handle(updatePasswordCall({
   customerNumber: customerIds.customerNumber,
   accountNumber: customerIds.accountNumber,
   mailId: mailAccountId,
   data: { password: newPassword },
 }))

Generally: you don't need the exact trigger type. Just write a function with the partial type that actually interests you (in this case I want the object to have a .unwrap function that returns a Promise.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vbelinschi
Comment options

Answer selected by vbelinschi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants