mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Remove userContext from pages dir
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import UserContext from '@/contexts/userContext';
|
||||
import useUser from '@/hooks/useUser';
|
||||
import '@/styles/globals.css';
|
||||
import type { AppProps } from 'next/app';
|
||||
import UserContext from './contexts/userContext';
|
||||
|
||||
export default function App({ Component, pageProps }: AppProps) {
|
||||
const { user, isLoading, error } = useUser();
|
||||
|
||||
@@ -3,6 +3,7 @@ import BeerInfoHeader from '@/components/BeerById/BeerInfoHeader';
|
||||
import BeerRecommendations from '@/components/BeerById/BeerRecommendations';
|
||||
import CommentCard from '@/components/BeerById/CommentCard';
|
||||
import Layout from '@/components/ui/Layout';
|
||||
import UserContext from '@/contexts/userContext';
|
||||
import getAllBeerComments from '@/services/BeerComment/getAllBeerComments';
|
||||
import { BeerCommentQueryResultArrayT } from '@/services/BeerComment/schema/BeerCommentQueryResult';
|
||||
import getBeerPostById from '@/services/BeerPost/getBeerPostById';
|
||||
@@ -13,7 +14,6 @@ import { NextPage, GetServerSideProps } from 'next';
|
||||
import Head from 'next/head';
|
||||
import Image from 'next/image';
|
||||
import { useState, useEffect, useContext } from 'react';
|
||||
import UserContext from '../contexts/userContext';
|
||||
|
||||
interface BeerPageProps {
|
||||
beerPost: BeerPostQueryResult;
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import GetUserSchema from '@/services/user/schema/GetUserSchema';
|
||||
import { createContext } from 'react';
|
||||
import { z } from 'zod';
|
||||
|
||||
const UserContext = createContext<{
|
||||
user?: z.infer<typeof GetUserSchema>;
|
||||
error?: unknown;
|
||||
isLoading: boolean;
|
||||
}>({ isLoading: true });
|
||||
|
||||
export default UserContext;
|
||||
@@ -1,10 +1,10 @@
|
||||
import Layout from '@/components/ui/Layout';
|
||||
import Spinner from '@/components/ui/Spinner';
|
||||
import withPageAuthRequired from '@/config/auth/withPageAuthRequired';
|
||||
import UserContext from '@/contexts/userContext';
|
||||
|
||||
import { GetServerSideProps, NextPage } from 'next';
|
||||
import { useContext } from 'react';
|
||||
import UserContext from '../contexts/userContext';
|
||||
|
||||
const ProtectedPage: NextPage = () => {
|
||||
const { user, error, isLoading } = useContext(UserContext);
|
||||
|
||||
Reference in New Issue
Block a user