MCPcopy Create free account
hub / github.com/dailydotdev/apps / handleSuccess

Function handleSuccess

packages/shared/src/components/modals/Prompt.tsx:49–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 onFail();
48 };
49 const handleSuccess = () => {
50 if (isPending) {
51 return;
52 }
53
54 if (!onConfirm) {
55 onSuccess();
56 return;
57 }
58
59 const settle = (callback: () => void) => {
60 if (confirmingPrompt.current !== prompt) {
61 return;
62 }
63
64 confirmingPrompt.current = null;
65 setIsConfirming(false);
66 callback();
67 };
68
69 confirmingPrompt.current = prompt;
70 setIsConfirming(true);
71 Promise.resolve(onConfirm())
72 .then(() => settle(onSuccess))
73 .catch(() => settle(onError));
74 };
75
76 const cancelButtonProps = cancelButton ?? {};
77 const cancelActionButtonProps = {

Callers

nothing calls this directly

Calls 3

onConfirmFunction · 0.85
settleFunction · 0.70
onSuccessFunction · 0.50

Tested by

no test coverage detected