From d99faa798e84e93857eac88b06a46c0d6411d23e Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 17 Mar 2022 20:25:22 -0500 Subject: [PATCH 1/2] saving completed app shell --- src/ApplicationViews.js | 12 ++++++++++++ src/auth/Login.js | 0 src/auth/Register.js | 0 src/home/Home.js | 0 src/home/HomeManager.js | 0 src/images/MyImageManager.js | 0 src/images/MyImages.js | 0 src/profile/EditProfile.js | 0 src/profile/Profile.js | 0 src/profile/ProfileManager.js | 0 src/tags/PhotosByTag.js | 0 src/tags/SelectTags.js | 0 src/tags/TagManager.js | 0 13 files changed, 12 insertions(+) create mode 100644 src/auth/Login.js create mode 100644 src/auth/Register.js create mode 100644 src/home/Home.js create mode 100644 src/home/HomeManager.js create mode 100644 src/images/MyImageManager.js create mode 100644 src/images/MyImages.js create mode 100644 src/profile/EditProfile.js create mode 100644 src/profile/Profile.js create mode 100644 src/profile/ProfileManager.js create mode 100644 src/tags/PhotosByTag.js create mode 100644 src/tags/SelectTags.js create mode 100644 src/tags/TagManager.js diff --git a/src/ApplicationViews.js b/src/ApplicationViews.js index e69de29..f331876 100644 --- a/src/ApplicationViews.js +++ b/src/ApplicationViews.js @@ -0,0 +1,12 @@ +import React from "react"; +import { Route } from "react-router-dom"; + + +export const ApplicationViews = () => { + + return <> + <>
+ +
+ +} \ No newline at end of file diff --git a/src/auth/Login.js b/src/auth/Login.js new file mode 100644 index 0000000..e69de29 diff --git a/src/auth/Register.js b/src/auth/Register.js new file mode 100644 index 0000000..e69de29 diff --git a/src/home/Home.js b/src/home/Home.js new file mode 100644 index 0000000..e69de29 diff --git a/src/home/HomeManager.js b/src/home/HomeManager.js new file mode 100644 index 0000000..e69de29 diff --git a/src/images/MyImageManager.js b/src/images/MyImageManager.js new file mode 100644 index 0000000..e69de29 diff --git a/src/images/MyImages.js b/src/images/MyImages.js new file mode 100644 index 0000000..e69de29 diff --git a/src/profile/EditProfile.js b/src/profile/EditProfile.js new file mode 100644 index 0000000..e69de29 diff --git a/src/profile/Profile.js b/src/profile/Profile.js new file mode 100644 index 0000000..e69de29 diff --git a/src/profile/ProfileManager.js b/src/profile/ProfileManager.js new file mode 100644 index 0000000..e69de29 diff --git a/src/tags/PhotosByTag.js b/src/tags/PhotosByTag.js new file mode 100644 index 0000000..e69de29 diff --git a/src/tags/SelectTags.js b/src/tags/SelectTags.js new file mode 100644 index 0000000..e69de29 diff --git a/src/tags/TagManager.js b/src/tags/TagManager.js new file mode 100644 index 0000000..e69de29 -- 2.47.3 From c972a2469983e039a794c31cb74a9f2d442f2292 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 17 Mar 2022 20:37:34 -0500 Subject: [PATCH 2/2] added missing Navbar.js file --- src/ApplicationViews.js | 10 ++++-- src/auth/Login.js | 68 +++++++++++++++++++++++++++++++++++++++++ src/nav/NavBar.js | 0 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 src/nav/NavBar.js diff --git a/src/ApplicationViews.js b/src/ApplicationViews.js index f331876..be5aef0 100644 --- a/src/ApplicationViews.js +++ b/src/ApplicationViews.js @@ -4,9 +4,13 @@ import { Route } from "react-router-dom"; export const ApplicationViews = () => { - return <> - <>
+ return ( + + <> + +
-
+
+ ) } \ No newline at end of file diff --git a/src/auth/Login.js b/src/auth/Login.js index e69de29..962ffc0 100644 --- a/src/auth/Login.js +++ b/src/auth/Login.js @@ -0,0 +1,68 @@ +import React, { useRef } from "react" +import { Link, useHistory } from "react-router-dom" +import "./Auth.css" + + +export const Login = () => { + const username = useRef() + const password = useRef() + const invalidDialog = useRef() + const history = useHistory() + + const handleLogin = (e) => { + e.preventDefault() + + return fetch("http://127.0.0.1:8000/login", { + method: "POST", + headers: { + "Content-Type": "application/json", + "Accept": "application/json" + }, + body: JSON.stringify({ + username: username.current.value, + password: password.current.value + }) + }) + .then(res => res.json()) + .then(res => { + if ("valid" in res && res.valid && "token" in res) { + localStorage.setItem("sf_token", res.token) + history.push("/") + } + else { + invalidDialog.current.showModal() + } + }) + } + + return ( +
+ +
Username or password was not valid.
+ +
+
+
+

SmugFolio

+

Please sign in

+
+ + +
+
+ + +
+
+ +
+
+
+
+ Register +
+
+ ) +} diff --git a/src/nav/NavBar.js b/src/nav/NavBar.js new file mode 100644 index 0000000..e69de29 -- 2.47.3