mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-19 13:09:30 +01:00
web: go back on overlay checkout closed
This commit is contained in:
@@ -21,7 +21,7 @@ import "../app.css";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Flex } from "@theme-ui/components";
|
import { Flex } from "@theme-ui/components";
|
||||||
import { hardNavigate, useQueryParams } from "../navigation";
|
import { hardNavigate, useQueryParams } from "../navigation";
|
||||||
import { initializePaddle } from "@paddle/paddle-js";
|
import { CheckoutEventNames, initializePaddle } from "@paddle/paddle-js";
|
||||||
import { CLIENT_PADDLE_TOKEN } from "../dialogs/buy-dialog/paddle";
|
import { CLIENT_PADDLE_TOKEN } from "../dialogs/buy-dialog/paddle";
|
||||||
import { Loader } from "../components/loader";
|
import { Loader } from "../components/loader";
|
||||||
import { IS_DEV } from "../dialogs/buy-dialog/helpers";
|
import { IS_DEV } from "../dialogs/buy-dialog/helpers";
|
||||||
@@ -35,7 +35,11 @@ function Payments() {
|
|||||||
(async function () {
|
(async function () {
|
||||||
const paddle = await initializePaddle({
|
const paddle = await initializePaddle({
|
||||||
token: CLIENT_PADDLE_TOKEN,
|
token: CLIENT_PADDLE_TOKEN,
|
||||||
environment: IS_DEV ? "sandbox" : "production"
|
environment: IS_DEV ? "sandbox" : "production",
|
||||||
|
eventCallback: (event) => {
|
||||||
|
if (event.name === CheckoutEventNames.CHECKOUT_CLOSED)
|
||||||
|
window.history.back();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (!paddle) return hardNavigate("/notes");
|
if (!paddle) return hardNavigate("/notes");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user