mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-04-11 13:29:13 +02:00
fix shared import and user admin access
This commit is contained in:
parent
3e69555aca
commit
d9034fbc40
@ -7,8 +7,15 @@ import ReferrerTable from '../../components/ReferrerTable';
|
||||
import DefaultLayout from '../../layout/DefaultLayout';
|
||||
import { useQuery } from '@wasp/queries';
|
||||
import getDailyStats from '@wasp/queries/getDailyStats';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import type { User } from '@wasp/entities';
|
||||
|
||||
const ECommerce = () => {
|
||||
const ECommerce = ({ user} : { user: User }) => {
|
||||
const history = useHistory();
|
||||
if (!user.isAdmin) {
|
||||
history.push('/');
|
||||
}
|
||||
|
||||
const { data: stats, isLoading, error } = useQuery(getDailyStats);
|
||||
|
||||
return (
|
||||
|
@ -5,7 +5,7 @@ import logout from '@wasp/auth/logout';
|
||||
import { useState, Dispatch, SetStateAction } from 'react';
|
||||
import { Link } from '@wasp/router'
|
||||
import { CUSTOMER_PORTAL_LINK } from '../../shared/const';
|
||||
|
||||
import { TierIds } from '@wasp/shared/const';
|
||||
|
||||
export default function AccountPage({ user }: { user: User }) {
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
@ -28,7 +28,7 @@ export default function AccountPage({ user }: { user: User }) {
|
||||
<dt className='text-sm font-medium text-gray-500'>Your Plan</dt>
|
||||
{user.hasPaid ? (
|
||||
<>
|
||||
<dd className='mt-1 text-sm text-gray-900 sm:col-span-1 sm:mt-0'>Premium Monthly Subscription</dd>
|
||||
{user.subscriptionStatus !== 'past_due' ? <dd className='mt-1 text-sm text-gray-900 sm:col-span-1 sm:mt-0'>{user.subscriptionTier === TierIds.HOBBY ? 'Hobby' : 'Pro' } Plan</dd> : <dd className='mt-1 text-sm text-gray-900 sm:col-span-1 sm:mt-0'>Your Account is Past Due! Please Update your Payment Information</dd>}
|
||||
<CustomerPortalButton isLoading={isLoading} setIsLoading={setIsLoading} />
|
||||
</>
|
||||
) : (
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { TierIds} from "../../shared/const";
|
||||
import { TierIds } from '@wasp/shared/const';
|
||||
|
||||
export const navigation = [
|
||||
{ name: 'Features', href: '#features' },
|
||||
|
@ -6,7 +6,7 @@ import type { GenerateGptResponse, StripePayment } from '@wasp/actions/types';
|
||||
import type { StripePaymentResult, OpenAIResponse } from './types';
|
||||
import { UpdateCurrentUser, SaveReferrer, UpdateUserReferrer, UpdateUserById } from '@wasp/actions/types';
|
||||
import { fetchStripeCustomer, createStripeCheckoutSession } from './stripeUtils.js';
|
||||
import { TierIds } from '../shared/const.js';
|
||||
import { TierIds } from '@wasp/shared/const.js';
|
||||
|
||||
export const stripePayment: StripePayment<string, StripePaymentResult> = async (tier, context) => {
|
||||
if (!context.user || !context.user.email) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user