diff --git a/apps/user-portal/components/ManageStripeButton.tsx b/apps/user-portal/components/ManageStripeButton.tsx
index 893a7c9..90f58fc 100644
--- a/apps/user-portal/components/ManageStripeButton.tsx
+++ b/apps/user-portal/components/ManageStripeButton.tsx
@@ -1,5 +1,4 @@
import { Button } from 'react-bootstrap';
-import React from 'react';
import getConfig from 'next/config';
import { useMutation } from '@apollo/client';
import { useSession } from 'next-auth/react';
@@ -20,7 +19,7 @@ export function ManageStripeButton() {
`;
const [getPortalSession] = useMutation(MANAGE_STRIPE_MUTATION, {
- //refetchQueries: [{ query: CURRENT_USER_QUERY }],
+ // refetchQueries: [{ query: CURRENT_USER_QUERY }],
});
if (!userData.id) {
return
;
diff --git a/apps/user-portal/components/SigninButton.tsx b/apps/user-portal/components/SigninButton.tsx
index 3f42e1e..73093ee 100644
--- a/apps/user-portal/components/SigninButton.tsx
+++ b/apps/user-portal/components/SigninButton.tsx
@@ -1,34 +1,31 @@
-import { signIn, signOut, useSession } from "next-auth/react";
-import { Navbar, Nav, Button } from "react-bootstrap";
-import Link from "next/link";
+import { signIn, signOut, useSession } from 'next-auth/react';
+import { Navbar, Nav, Button } from 'react-bootstrap';
+import Link from 'next/link';
-export function SigninButton() {
+export function SigninButton({ ...props }) {
+ const { returnUrl } = props;
const { data, status } = useSession();
+ if (!data)
+ return (
+
+ );
return (
- <>
- {!data ? (
-
- ) : (
- <>
-
- >
- )}
- >
+
);
}
diff --git a/apps/user-portal/components/SignupButton.tsx b/apps/user-portal/components/SignupButton.tsx
new file mode 100644
index 0000000..3525683
--- /dev/null
+++ b/apps/user-portal/components/SignupButton.tsx
@@ -0,0 +1,34 @@
+import { signIn, signOut, useSession } from 'next-auth/react';
+import { Navbar, Nav, Button } from 'react-bootstrap';
+import Link from 'next/link';
+
+export function SignupButton() {
+ const { data, status } = useSession();
+ if (!data)
+ return (
+
+ );
+ return (
+
+ );
+}
diff --git a/apps/user-portal/components/SubscribeButton.tsx b/apps/user-portal/components/SubscribeButton.tsx
index acb0abc..7068315 100644
--- a/apps/user-portal/components/SubscribeButton.tsx
+++ b/apps/user-portal/components/SubscribeButton.tsx
@@ -1,15 +1,14 @@
import { Button } from 'react-bootstrap';
-import React from 'react';
import getConfig from 'next/config';
import { useMutation } from '@apollo/client';
import { useSession } from 'next-auth/react';
import { useRouter } from 'next/dist/client/router';
import gql from 'graphql-tag';
+import { SigninButton } from './SigninButton';
import { User } from '../types';
export function SubscribeButton({ ...props }) {
const { data: userData, status } = useSession();
- const userSession = userData.data as User;
const router = useRouter();
const { variation, subscription, club } = props;
@@ -27,9 +26,18 @@ export function SubscribeButton({ ...props }) {
}
`;
+ const userSession = userData?.data as User;
const [getStripeSession] = useMutation(SUBSCRIPTION_MUTATION, {
- //refetchQueries: [{ query: CURRENT_USER_QUERY }],
+ // refetchQueries: [{ query: CURRENT_USER_QUERY }],
});
+ if (!userData) {
+ return (
+
+ );
+ }
+
const existingVariation = userSession.memberships.find(
(m) => m.variation.id === variation.id
);
@@ -38,7 +46,9 @@ export function SubscribeButton({ ...props }) {
<>
You already have this one and is it {existingVariation.status}