diff --git a/web/apps/payments/src/pages/desktop-redirect.tsx b/web/apps/payments/src/pages/desktop-redirect.tsx
index 89df55bb6..2dc5d0bb3 100644
--- a/web/apps/payments/src/pages/desktop-redirect.tsx
+++ b/web/apps/payments/src/pages/desktop-redirect.tsx
@@ -1,9 +1,9 @@
import { Container } from "components/Container";
import { Spinner } from "components/Spinner";
-import * as React from "react";
+import React, { useEffect } from "react";
-export default function DesktopRedirect() {
- React.useEffect(() => {
+const Page: React.FC = () => {
+ useEffect(() => {
const currentURL = new URL(window.location.href);
const desktopRedirectURL = new URL("ente://app/gallery");
desktopRedirectURL.search = currentURL.search;
@@ -15,4 +15,6 @@ export default function DesktopRedirect() {
);
-}
+};
+
+export default Page;
diff --git a/web/apps/payments/src/pages/index.tsx b/web/apps/payments/src/pages/index.tsx
index 98d4a586d..eef49fb7c 100644
--- a/web/apps/payments/src/pages/index.tsx
+++ b/web/apps/payments/src/pages/index.tsx
@@ -1,24 +1,19 @@
import { Container } from "components/Container";
import { Spinner } from "components/Spinner";
-import * as React from "react";
+import React, { useEffect } from "react";
import { parseAndHandleRequest } from "services/billing-service";
import S from "utils/strings";
-export default function Home() {
+const Page: React.FC = () => {
const [failed, setFailed] = React.useState(false);
- React.useEffect(() => {
- async function main() {
- try {
- await parseAndHandleRequest();
- } catch {
- setFailed(true);
- }
- }
- // TODO: audit
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
- main();
+ useEffect(() => {
+ parseAndHandleRequest().catch(() => {
+ setFailed(true);
+ });
}, []);
return {failed ? S.error_generic : };
-}
+};
+
+export default Page;
diff --git a/web/apps/payments/src/services/billing-service.ts b/web/apps/payments/src/services/billing-service.ts
index 63859be57..f4979326a 100644
--- a/web/apps/payments/src/services/billing-service.ts
+++ b/web/apps/payments/src/services/billing-service.ts
@@ -1,11 +1,4 @@
-// TODO: Audit this and other eslints
-/* eslint-disable @typescript-eslint/no-explicit-any */
-/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
-/* eslint-disable @typescript-eslint/no-unsafe-return */
-/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
-/* eslint-disable @typescript-eslint/no-unnecessary-condition */
-
import { loadStripe } from "@stripe/stripe-js";
/**
@@ -180,11 +173,11 @@ const createCheckoutSession = async (
throw new Error(`Unexpected response for ${url}: ${JSON.stringify(json)}`);
};
-export async function updateSubscription(
+const updateSubscription = async (
productID: string,
paymentToken: string,
redirectURL: string,
-) {
+) => {
try {
const accountCountry = await getUserStripeAccountCountry(paymentToken);
const stripe = await getStripe(redirectURL, accountCountry);
@@ -193,16 +186,18 @@ export async function updateSubscription(
productID,
);
switch (status) {
- case "success":
+ case "success": {
// Subscription was updated successfully, nothing more required
return redirectToApp(redirectURL, "success");
+ }
- case "requires_payment_method":
+ case "requires_payment_method": {
return redirectToApp(
redirectURL,
"fail",
"requires_payment_method",
);
+ }
case "requires_action": {
const { error } = await stripe.confirmCardPayment(clientSecret);
@@ -236,7 +231,7 @@ export async function updateSubscription(
redirectToApp(redirectURL, "fail", "server_error");
throw e;
}
-}
+};
type PaymentStatus = "success" | "requires_action" | "requires_payment_method";
diff --git a/web/apps/payments/src/styles/globals.css b/web/apps/payments/src/styles/globals.css
index 1aa7b00bd..bd4bd106b 100644
--- a/web/apps/payments/src/styles/globals.css
+++ b/web/apps/payments/src/styles/globals.css
@@ -9,7 +9,7 @@ body {
flex-direction: column;
justify-content: center;
align-items: center;
- min-width: 80svh;
+ min-height: 100svh;
}
.loading-spinner {