include nwc string in url callback

This commit is contained in:
Paul Miller
2023-10-23 17:52:19 -05:00
parent 94856d5b56
commit 95f2b4c1a3
2 changed files with 12 additions and 3 deletions

View File

@@ -42,9 +42,11 @@ export function NWCBudgetEditor(props: {
// If there's an initial profile, look at that, otherwise default to false
const auto_approve =
props.initialProfile?.require_approval !== undefined
props.initialAmount !== undefined ||
props.initialInterval !== undefined ||
(props.initialProfile?.require_approval !== undefined
? !props.initialProfile?.require_approval
: false;
: false);
// prop amount -> profile editing -> subscriptions -> 0
// (ternaries take precendence so I put it in parens)

View File

@@ -308,7 +308,14 @@ function Nwc() {
// If there's a "return_to" param we use that instead of the callbackUri scheme
const returnUrl = searchParams.return_to;
if (returnUrl) {
setCallbackUri(returnUrl);
// add the nwc query param to the return url
const fullURI =
returnUrl +
(returnUrl.includes("?") ? "&" : "?") +
"nwc=" +
encodeURIComponent(newProfile.nwc_uri);
setCallbackUri(fullURI);
setCallbackDialogOpen(true);
}