Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyleye committed Dec 1, 2021
1 parent e70a644 commit ede3e78
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 32 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Auth/auth-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const AuthForm = ({ isSignup = false, onSubmit }) => {
type="submit"
className={styles.submitBtn}
>
{isSignup ? "Sign In" : "Sign Up"}
{isSignup ? "Sign Up" : "Sign In"}
</button>
)}
</div>
Expand Down
17 changes: 13 additions & 4 deletions client/src/components/Auth/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from "react";
import { Container } from "@material-ui/core";
import { Switch, Route, useHistory } from "react-router-dom";
import SignupForm from "./signup-form";
import LoginForm from "./login-form";
import AuthForm from "./auth-form";
import { useDispatch } from "react-redux";
import { signin, signup } from "../../actions/auth";

const Auth = () => {
const history = useHistory();
Expand All @@ -13,11 +14,19 @@ const Auth = () => {
history.push("/dashboard");
}

const dispatch = useDispatch();

return (
<Container component="main" maxWidth="xs">
<Switch>
<Route path="/login" component={LoginForm} />
<Route path="/signup" component={SignupForm} />
<Route
path="/login"
component={() => <AuthForm onSubmit={() => dispatch(signin())} />}
/>
<Route
path="/signup"
component={() => <AuthForm isSignup onSubmit={() => dispatch(signup())} />}
/>
</Switch>
</Container>
);
Expand Down
14 changes: 0 additions & 14 deletions client/src/components/Auth/login-form.js

This file was deleted.

13 changes: 0 additions & 13 deletions client/src/components/Auth/signup-form.js

This file was deleted.

0 comments on commit ede3e78

Please sign in to comment.