-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add purchase callback #34
Add purchase callback #34
Conversation
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/[email protected] |
} | ||
|
||
const { data, errors } = | ||
await client.mutate<CheckPurchaseOrderStatusMutation>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quizas podríamos usar el useCheckPurchaseOrderStatusMutation()
, y llamar la función dentro de un useEffect
.
Como porque si este componente se re-renderiza onda... X veces, se manda la mutación X veces también.
(O llamar client.mutate()
dentro de un useEffect
también funcionaría, pero es mas comun usar el useCheckPurchaseOrderStatusMutation
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lo habia intentado asi al principio, pero entraba en conflicto con el SSR. Si lo transformo a un client component podría usar useEffect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
si, filo con SSR :D
<CardTitle>Oops!</CardTitle> | ||
<CardContent> | ||
<ol> | ||
{errors.map((error, index) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: derepente esto va a exponer como errores onda internos o no? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sip, pero quiero dejarlo como placeholder y mejorarlo despues: #35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏🏼
Adds a simple purchase callback, to manage the signal back from commerce (Stripe/MercadoPago) and trigger CheckPurchaseOrderStatus mutation