Skip to content

Commit

Permalink
mostly remove NEXT_PUBLIC_PROJECT_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
gudnuf committed Sep 11, 2024
1 parent b9481d6 commit 4d52b92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
23 changes: 12 additions & 11 deletions src/pages/api/tip/[pubkey].ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,18 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
parseFloat(amount as string),
);

axios.post(
`${process.env.NEXT_PUBLIC_PROJECT_URL}/api/invoice/polling/${quote}?isTip=true`,
{
pubkey: user.pubkey,
amount: amount,
keysetId: wallet.keys.id,
mintUrl: wallet.mint.mintUrl,
gift,
fee,
},
);
const host = req.headers.host;
const protocol = process.env.NODE_ENV === 'production' ? 'https' : 'http';
const baseUrl = `${protocol}://${host}`;

axios.post(`${baseUrl}/api/invoice/polling/${quote}?isTip=true`, {
pubkey: user.pubkey,
amount: amount,
keysetId: wallet.keys.id,
mintUrl: wallet.mint.mintUrl,
gift,
fee,
});

return res.status(200).json({
invoice,
Expand Down
6 changes: 5 additions & 1 deletion src/pages/api/users/[pubkey]/receive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ export default async function handler(

await createMintQuote(quote, invoice, user.pubkey, wallet.keys.id, amountCents);

axios.post(`${process.env.NEXT_PUBLIC_PROJECT_URL}/api/invoice/polling/${quote}`, {
const host = req.headers.host;
const protocol = process.env.NODE_ENV === 'production' ? 'https' : 'http';
const baseUrl = `${protocol}://${host}`;

axios.post(`${baseUrl}/api/invoice/polling/${quote}`, {
pubkey: user.pubkey,
amount: amountCents,
keysetId: wallet.keys.id,
Expand Down

0 comments on commit 4d52b92

Please sign in to comment.