Skip to content

Commit bdd99b1

Browse files
authored
Merge pull request #952 from mastodon/fixes/donate-env
Fixes bug with donation widget in production environment
2 parents 2f7a1d9 + e3fbd53 commit bdd99b1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pages/donate/checkout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ export const getServerSideProps: GetServerSideProps<
131131
currency,
132132
locale,
133133
source: "menu",
134-
environment: "staging",
135134
})
135+
if (process.env.APP_ENV !== "production") {
136+
params.set("environment", "staging")
137+
}
136138
const response = await fetch(`${url}?${params}`, {
137139
headers: {
138140
"Content-Type": "application/json",

pages/donate/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,11 @@ export const getServerSideProps: GetServerSideProps<DonatePageProps> = async ({
104104
platform: "android",
105105
seed,
106106
source: "menu",
107-
environment: "staging",
108107
return_url: `${req.headers.host}/sponsor`,
109108
})
109+
if (process.env.APP_ENV !== "production") {
110+
queryParams.set("environment", "staging")
111+
}
110112

111113
try {
112114
const apiRes = await fetchEndpoint<CampaignResponse>(

0 commit comments

Comments
 (0)