feat: append email to checkout url

This commit is contained in:
AykutSarac 2023-07-28 00:36:53 +03:00
parent 93b92be14a
commit 7597a244fd
No known key found for this signature in database
4 changed files with 13 additions and 4 deletions

View File

@ -197,7 +197,7 @@ export const PremiumView = () => (
component="a"
variant="gradient"
gradient={{ from: "blue", to: "teal" }}
href={paymentURL}
href={paymentURL()}
target="_blank"
>
UPGRADE TO PREMIUM $5.00

View File

@ -1,5 +1,14 @@
import useUser from "src/store/useUser";
export const baseURL = process.env.NEXT_PUBLIC_BASE_URL as string;
export const paymentURL = process.env.NEXT_PUBLIC_PAYMENT_URL as string;
export const paymentURL = () => {
const email = useUser.getState().user?.email;
let url = process.env.NEXT_PUBLIC_PAYMENT_URL as string;
if (email) url += `?checkout[email]=${email}`;
return url;
};
// Example taken from https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json
const sampleJson = Object.freeze({

View File

@ -53,7 +53,7 @@ export const PremiumModal: React.FC<ModalProps> = ({ opened, onClose }) => {
</Title>
<Button
component="a"
href={paymentURL}
href={paymentURL()}
variant="filled"
color="teal"
size="md"

View File

@ -64,7 +64,7 @@ const Pricing = () => {
</Title>
<Button
component="a"
href={paymentURL}
href={paymentURL()}
variant="filled"
color="teal"
size="md"