From b22dd6f5e88a7277cdb455bbd5447d2b3f29559b Mon Sep 17 00:00:00 2001 From: cami Date: Wed, 23 Jun 2021 03:40:37 +0200 Subject: [PATCH 1/2] Adjusted formatting --- frontend/src/App.css | 4 ++-- frontend/src/auth/AuthProvider.js | 17 ++++++++--------- frontend/src/auth/PrivateRoute.js | 2 +- frontend/src/components/Button.js | 1 - frontend/src/components/Input.css | 4 ++-- frontend/src/components/InputField.js | 7 ++++++- frontend/src/components/SubmitField.js | 4 ++-- frontend/src/components/pages/Register.js | 8 ++++---- frontend/src/components/pages/Secret.js | 4 ++-- frontend/src/components/pages/SignUp.js | 12 ------------ frontend/src/components/pages/Ueber.js | 3 ++- 11 files changed, 29 insertions(+), 37 deletions(-) delete mode 100644 frontend/src/components/pages/SignUp.js diff --git a/frontend/src/App.css b/frontend/src/App.css index 8afe2d9..49af386 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -8,9 +8,9 @@ :root { --primary: rgb(41, 63, 87); --primary-contr: rgb(9, 11, 46); - --secondary: rgb(218,218,218); + --secondary: rgb(218, 218, 218); --third: rgb(171, 183, 183); - --forth: rgb(255,255,255); + --forth: rgb(255, 255, 255); } .home, diff --git a/frontend/src/auth/AuthProvider.js b/frontend/src/auth/AuthProvider.js index 03f4e0a..fe5977d 100644 --- a/frontend/src/auth/AuthProvider.js +++ b/frontend/src/auth/AuthProvider.js @@ -1,11 +1,10 @@ import { createAuthProvider } from "react-token-auth"; -export const [useAuth, authFetch, login, logout] = -createAuthProvider({ - accessTokenKey: 'access_token', - onUpdateToken: (token) => fetch('/api/refresh', { - method: 'POST', - body: token.access_token - }) - .then(r => r.json()) -}) +export const [useAuth, authFetch, login, logout] = createAuthProvider({ + accessTokenKey: "access_token", + onUpdateToken: (token) => + fetch("/api/refresh", { + method: "POST", + body: token.access_token, + }).then((r) => r.json()), +}); diff --git a/frontend/src/auth/PrivateRoute.js b/frontend/src/auth/PrivateRoute.js index decf7ce..15708fd 100644 --- a/frontend/src/auth/PrivateRoute.js +++ b/frontend/src/auth/PrivateRoute.js @@ -14,4 +14,4 @@ const PrivateRoute = ({ component: Component, ...rest }) => { ); }; -export default PrivateRoute \ No newline at end of file +export default PrivateRoute; diff --git a/frontend/src/components/Button.js b/frontend/src/components/Button.js index f7312df..2353f06 100644 --- a/frontend/src/components/Button.js +++ b/frontend/src/components/Button.js @@ -2,7 +2,6 @@ import React from "react"; import "./Button.css"; import { Link } from "react-router-dom"; - const STYLES = ["btn--primary", "btn--outline"]; const SIZES = ["btn--medium", "btn--large"]; diff --git a/frontend/src/components/Input.css b/frontend/src/components/Input.css index 4738348..fdd70e1 100644 --- a/frontend/src/components/Input.css +++ b/frontend/src/components/Input.css @@ -23,5 +23,5 @@ } .input-field input[type="submit"]:hover { - background-color: var(--primary-contr); -} \ No newline at end of file + background-color: var(--primary-contr); +} diff --git a/frontend/src/components/InputField.js b/frontend/src/components/InputField.js index 664f218..2c3767f 100644 --- a/frontend/src/components/InputField.js +++ b/frontend/src/components/InputField.js @@ -5,7 +5,12 @@ function InputField(props) { return ( ); } diff --git a/frontend/src/components/SubmitField.js b/frontend/src/components/SubmitField.js index 968ec7f..42619ea 100644 --- a/frontend/src/components/SubmitField.js +++ b/frontend/src/components/SubmitField.js @@ -1,6 +1,6 @@ import React from "react"; -import "./Input.css" -import "./Button.css" +import "./Input.css"; +import "./Button.css"; function SubmitField(props) { const InputValue = props.LabelName; diff --git a/frontend/src/components/pages/Register.js b/frontend/src/components/pages/Register.js index a72f41d..3145a26 100644 --- a/frontend/src/components/pages/Register.js +++ b/frontend/src/components/pages/Register.js @@ -6,10 +6,10 @@ import InputField from "../InputField"; import SubmitField from "../SubmitField"; export default function Login() { - const [username, setUsername] = useState('') - const [password, setPassword] = useState('') + const [username, setUsername] = useState(""); + const [password, setPassword] = useState(""); - const onSubmitClick = (e) => { + const onSubmitClick = (e) => { e.preventDefault(); let opts = { username: username, @@ -19,7 +19,7 @@ export default function Login() { fetch("/api/register", { method: "post", body: JSON.stringify(opts), - }) + }); }; const handleUsernameChange = (e) => { diff --git a/frontend/src/components/pages/Secret.js b/frontend/src/components/pages/Secret.js index b36e497..5101e9b 100644 --- a/frontend/src/components/pages/Secret.js +++ b/frontend/src/components/pages/Secret.js @@ -1,5 +1,5 @@ import { useEffect, useState } from "react/cjs/react.development"; -import {authFetch} from "../../auth/AuthProvider.js" +import { authFetch } from "../../auth/AuthProvider.js"; function Secret() { const [message, setMessage] = useState(""); @@ -22,4 +22,4 @@ function Secret() { return

Secret: {message}

; } -export default Secret; \ No newline at end of file +export default Secret; diff --git a/frontend/src/components/pages/SignUp.js b/frontend/src/components/pages/SignUp.js deleted file mode 100644 index 27e6fa5..0000000 --- a/frontend/src/components/pages/SignUp.js +++ /dev/null @@ -1,12 +0,0 @@ -import React from "react"; -import "../../App.css"; -import Footer from "../../Footer"; - -export default function SignUp() { - return ( - <> -

SIGN UP

-