completed registration function #14

Merged
JMR-dev merged 1 commits from jr-register into main 2022-03-18 20:48:35 +00:00
7 changed files with 75 additions and 6 deletions
+4 -1
View File
@@ -1,4 +1,5 @@
import React from "react";
import { Home } from "./home/Home";
import { Route } from "react-router-dom";
@@ -9,7 +10,9 @@ export const ApplicationViews = () => {
<>
<main>
<Route exact path="/">
<Home />
</Route>
</main>
</>
)
+6 -5
View File
@@ -6,7 +6,7 @@ export const Register = () => {
const firstName = useRef()
const lastName = useRef()
const username = useRef()
const bio = useRef()
const email = useRef()
const password = useRef()
const verifyPassword = useRef()
const passwordDialog = useRef()
@@ -18,6 +18,7 @@ export const Register = () => {
if (password.current.value === verifyPassword.current.value) {
const newUser = {
"username": username.current.value,
"email": email.current.value,
"first_name": firstName.current.value,
"last_name": lastName.current.value,
"password": password.current.value
@@ -65,6 +66,10 @@ export const Register = () => {
<label htmlFor="inputUsername">Username</label>
<input ref={username} type="text" name="username" className="form-control" placeholder="Username" required />
</fieldset>
<fieldset>
<label htmlFor="inputEmail">Email</label>
<input ref={email} type="text" name="email" className="form-control" placeholder="Email" required />
</fieldset>
<fieldset>
<label htmlFor="inputPassword"> Password </label>
<input ref={password} type="password" name="password" className="form-control" placeholder="Password" required />
@@ -73,10 +78,6 @@ export const Register = () => {
<label htmlFor="verifyPassword"> Verify Password </label>
<input ref={verifyPassword} type="password" name="verifyPassword" className="form-control" placeholder="Verify password" required />
</fieldset>
<fieldset>
<label htmlFor="verifyPassword"> Verify Password </label>
<textarea ref={bio} name="bio" className="form-control" placeholder="Let other gamers know a little bit about you..." />
</fieldset>
<fieldset style={{
textAlign: "center"
}}>
+13
View File
@@ -0,0 +1,13 @@
import React, {useState, useEffect} from "react";
import { useHistory,useParams } from "react-router-dom";
export const Home = () => {
const homeImages = useState([])
const history = useHistory
return(
<>
<h1>SmugFolio</h1>
</>
)
}
+8
View File
@@ -0,0 +1,8 @@
export const getImages = () => {
return fetch("http://localhost:8000/images", {
headers:{
"Authorization": `Token ${localStorage.getItem("sf_token")}`
}
})
.then(response => response.json())
}
+8
View File
@@ -0,0 +1,8 @@
export const getImages = () => {
return fetch("http://localhost:8000/images", {
headers:{
"Authorization": `Token ${localStorage.getItem("sf_token")}`
}
})
.then(response => response.json())
}
+22
View File
@@ -0,0 +1,22 @@
export const getSmug_UserById = (id) => {
return fetch(`http://localhost:8000/smug_users/${id}`, {
headers:{
"Authorization": `Token ${localStorage.getItem("sf_token")}`
}
})
.then(response => response.json())
}
export const putSmug_User = (editedProfile) => {
return fetch(`http://localhost:8000/games/${editedProfile.id}`, {
method: "PUT",
body: JSON.stringify(
editedProfile
),
headers:{
"Authorization": `Token ${localStorage.getItem("sf_token")}`,
"Content-Type": "Application/json"
}
}
)
}
+14
View File
@@ -0,0 +1,14 @@
export const createTags = (event) => {
return fetch(`http://localhost:8000/events`, {
method: "POST",
headers:{
"Authorization": `Token ${localStorage.getItem("sf_token")}`,
"Content-Type": "Application/json"
}
}
)
.then(response => response.json())
}