diff --git a/frontend/src/components/createUser.js b/frontend/src/components/createUser.js
index 4a5780c..4b4da97 100644
--- a/frontend/src/components/createUser.js
+++ b/frontend/src/components/createUser.js
@@ -1,16 +1,16 @@
export default function CreateUser() {
function onSubmission(event){
- var firstName = event.target.elements.firstName.value;
- var lastName = event.target.elements.lastName.value;
- console.log(firstName);
- console.log(lastName);
+ var fullName = event.target.elements.fullName.value;
+ var email = event.target.elements.email.value;
+ console.log(fullName);
+ console.log(email);
fetch("https://jsonplaceholder.typicode.com/users", {
method: "POST",
body: JSON.stringify({
- firstName,
- lastName,
+ fullName,
+ email,
}),
headers: {
"Content-type": "application/json; charset=UTF-8",
@@ -28,12 +28,12 @@ export default function CreateUser() {
diff --git a/frontend/src/components/user.js b/frontend/src/components/user.js
index 0fd0823..dd39b4e 100644
--- a/frontend/src/components/user.js
+++ b/frontend/src/components/user.js
@@ -1,9 +1,9 @@
-export default function User({id,firstName,lastName}) {
+export default function User({id,fullName,email}) {
return (
| {id} |
- {firstName} |
- {lastName} |
+ {fullName} |
+ {email} |
Go
Python
diff --git a/frontend/src/components/userlist.js b/frontend/src/components/userlist.js
index cf86c56..ac41767 100644
--- a/frontend/src/components/userlist.js
+++ b/frontend/src/components/userlist.js
@@ -1,7 +1,10 @@
+import React, { useState, useEffect } from 'react';
import User from "./user";
export default function UserList() {
+ const [data, setData] = useState([]);
+
function reloadUserList(event){
console.log(event);
fetch("https://jsonplaceholder.typicode.com/users", {
@@ -13,41 +16,35 @@ export default function UserList() {
.then(response => response.json())
.then(data => {
console.log(data);
+ setData(data);
alert(JSON.stringify(data));
})
};
return (
-
-
User List
-
-
-
-
+
-
-
-
- | #ID |
- First |
- Last |
- Skills |
-
-
-
-
- {/*
-
-
- */}
-
-
+
+
+
+ | #ID |
+ Full Name |
+ Email |
+ Skills |
+
+
+
+ {
+ data.map((item)=>(
+
+ ))
+ }
+
+
diff --git a/main.go b/main.go
index e7e7fef..53bf46a 100644
--- a/main.go
+++ b/main.go
@@ -24,7 +24,7 @@ func main() {
})
})
- r.Use(static.Serve("/", static.LocalFile("./skillmap/build", true)))
+ r.Use(static.Serve("/", static.LocalFile("./frontend/build", true)))
r.Run() // listen and serve on 0.0.0.0:8080
}
|