Skip to content

Commit

Permalink
cleaner imports
Browse files Browse the repository at this point in the history
  • Loading branch information
karlkeefer committed Oct 11, 2022
1 parent 1a68084 commit 9198812
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BrowserRouter as Router } from 'react-router-dom'

import Nav from 'Nav/Nav'
import Routes from 'Routes/Routes'
import { WithUser } from 'Shared/Context'
import { WithUser } from 'Shared/UserContainer'

const App = () => (
<WithUser>
Expand Down
2 changes: 1 addition & 1 deletion react/src/Nav/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { useLocation } from 'react-router'
import { NavLink, NavLinkProps } from 'react-router-dom'
import { Button, Container, Menu } from 'semantic-ui-react'

import { UserContainer } from 'Shared/Context'
import { Anon, LoggedIn } from 'Shared/Roles'
import { UserContainer } from 'Shared/UserContainer'

import './responsive.css'

Expand Down
2 changes: 1 addition & 1 deletion react/src/Routes/Helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Redirect, RouteProps } from 'react-router'
import { Route } from 'react-router-dom'
import { Loader, Container, Dimmer } from 'semantic-ui-react'

import { UserContainer } from 'Shared/Context'
import SimplePage from 'Shared/SimplePage'
import { UserContainer } from 'Shared/UserContainer'

// check the user is logged in, and redirect to login screen if still not auth'd

Expand Down
2 changes: 1 addition & 1 deletion react/src/Routes/LogIn/LogInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Redirect, useLocation } from 'react-router-dom'
import { Form, Button, Message } from 'semantic-ui-react'

import API from 'Api'
import { UserContainer } from 'Shared/Context'
import { useRequest, useFields, InputChangeHandler } from 'Shared/Hooks';
import { User } from 'Shared/Models'
import { UserContainer } from 'Shared/UserContainer'

const LogInForm = () => {
const location = useLocation<{ from: string }>()
Expand Down
8 changes: 4 additions & 4 deletions react/src/Routes/Posts/Posts.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import react from 'react'
import React, { useContext, useEffect } from 'react'

import { Link } from 'react-router-dom'
import { Segment, Message, Header, Button, Placeholder } from 'semantic-ui-react'

import API from 'Api'
import { UserContainer } from 'Shared/Context'
import { useRequest } from 'Shared/Hooks'
import { Post } from 'Shared/Models'
import SimplePage from 'Shared/SimplePage'
import { UserContainer } from 'Shared/UserContainer'

const Posts = () => {
const [loading, error, run, posts] = useRequest([])
const { user } = react.useContext(UserContainer)
const { user } = useContext(UserContainer)

react.useEffect(() => {
useEffect(() => {
run(API.getPosts())
}, [run])

Expand Down
2 changes: 1 addition & 1 deletion react/src/Routes/Reset/CheckReset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { useParams } from 'react-router'
import { Redirect } from 'react-router-dom'

import API from 'Api'
import { UserContainer } from 'Shared/Context'
import { useRequest } from 'Shared/Hooks';
import { User } from 'Shared/Models'
import SimplePage from 'Shared/SimplePage';
import { UserContainer } from 'Shared/UserContainer'

const CheckReset = () => {
const { code } = useParams<{ code: string }>();
Expand Down
2 changes: 1 addition & 1 deletion react/src/Routes/Verify/Verify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Redirect } from 'react-router-dom'
import { Message } from 'semantic-ui-react'

import API from 'Api'
import { UserContainer } from 'Shared/Context'
import { useRequest } from 'Shared/Hooks';
import { User } from 'Shared/Models'
import SimplePage from 'Shared/SimplePage'
import { UserContainer } from 'Shared/UserContainer'

const Verify = () => {
const { code } = useParams<{ code: string }>();
Expand Down
2 changes: 1 addition & 1 deletion react/src/Shared/Roles.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext } from 'react'

import { UserContainer } from 'Shared/Context'
import { UserContainer } from 'Shared/UserContainer'

export const LoggedIn = ({ children }: { children: React.ReactNode }) => {
const { user } = useContext(UserContainer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const UserContainer = React.createContext({
handleLogout: () => { }
});


export const WithUser = ({ children }: { children: React.ReactNode }) => {
const [user, setUser] = useState({} as User)
const [userLoading, setLoading] = useState(true)
Expand Down

0 comments on commit 9198812

Please sign in to comment.