mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Remove userContext from pages dir
This commit is contained in:
@@ -4,9 +4,10 @@ import format from 'date-fns/format';
|
|||||||
import { useContext, useEffect, useState } from 'react';
|
import { useContext, useEffect, useState } from 'react';
|
||||||
import { FaRegThumbsUp, FaThumbsUp } from 'react-icons/fa';
|
import { FaRegThumbsUp, FaThumbsUp } from 'react-icons/fa';
|
||||||
import BeerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
|
import BeerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||||
import UserContext from '@/pages/contexts/userContext';
|
|
||||||
import APIResponseValidationSchema from '@/validation/APIResponseValidationSchema';
|
import APIResponseValidationSchema from '@/validation/APIResponseValidationSchema';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
import UserContext from '@/contexts/userContext';
|
||||||
|
|
||||||
const BeerInfoHeader: React.FC<{ beerPost: BeerPostQueryResult }> = ({ beerPost }) => {
|
const BeerInfoHeader: React.FC<{ beerPost: BeerPostQueryResult }> = ({ beerPost }) => {
|
||||||
const createdAtDate = new Date(beerPost.createdAt);
|
const createdAtDate = new Date(beerPost.createdAt);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import UserContext from '@/contexts/userContext';
|
||||||
import useUser from '@/hooks/useUser';
|
import useUser from '@/hooks/useUser';
|
||||||
import '@/styles/globals.css';
|
import '@/styles/globals.css';
|
||||||
import type { AppProps } from 'next/app';
|
import type { AppProps } from 'next/app';
|
||||||
import UserContext from './contexts/userContext';
|
|
||||||
|
|
||||||
export default function App({ Component, pageProps }: AppProps) {
|
export default function App({ Component, pageProps }: AppProps) {
|
||||||
const { user, isLoading, error } = useUser();
|
const { user, isLoading, error } = useUser();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import BeerInfoHeader from '@/components/BeerById/BeerInfoHeader';
|
|||||||
import BeerRecommendations from '@/components/BeerById/BeerRecommendations';
|
import BeerRecommendations from '@/components/BeerById/BeerRecommendations';
|
||||||
import CommentCard from '@/components/BeerById/CommentCard';
|
import CommentCard from '@/components/BeerById/CommentCard';
|
||||||
import Layout from '@/components/ui/Layout';
|
import Layout from '@/components/ui/Layout';
|
||||||
|
import UserContext from '@/contexts/userContext';
|
||||||
import getAllBeerComments from '@/services/BeerComment/getAllBeerComments';
|
import getAllBeerComments from '@/services/BeerComment/getAllBeerComments';
|
||||||
import { BeerCommentQueryResultArrayT } from '@/services/BeerComment/schema/BeerCommentQueryResult';
|
import { BeerCommentQueryResultArrayT } from '@/services/BeerComment/schema/BeerCommentQueryResult';
|
||||||
import getBeerPostById from '@/services/BeerPost/getBeerPostById';
|
import getBeerPostById from '@/services/BeerPost/getBeerPostById';
|
||||||
@@ -13,7 +14,6 @@ import { NextPage, GetServerSideProps } from 'next';
|
|||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { useState, useEffect, useContext } from 'react';
|
import { useState, useEffect, useContext } from 'react';
|
||||||
import UserContext from '../contexts/userContext';
|
|
||||||
|
|
||||||
interface BeerPageProps {
|
interface BeerPageProps {
|
||||||
beerPost: BeerPostQueryResult;
|
beerPost: BeerPostQueryResult;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import Layout from '@/components/ui/Layout';
|
import Layout from '@/components/ui/Layout';
|
||||||
import Spinner from '@/components/ui/Spinner';
|
import Spinner from '@/components/ui/Spinner';
|
||||||
import withPageAuthRequired from '@/config/auth/withPageAuthRequired';
|
import withPageAuthRequired from '@/config/auth/withPageAuthRequired';
|
||||||
|
import UserContext from '@/contexts/userContext';
|
||||||
|
|
||||||
import { GetServerSideProps, NextPage } from 'next';
|
import { GetServerSideProps, NextPage } from 'next';
|
||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import UserContext from '../contexts/userContext';
|
|
||||||
|
|
||||||
const ProtectedPage: NextPage = () => {
|
const ProtectedPage: NextPage = () => {
|
||||||
const { user, error, isLoading } = useContext(UserContext);
|
const { user, error, isLoading } = useContext(UserContext);
|
||||||
|
|||||||
Reference in New Issue
Block a user