Skip to content

Commit 09440cb

Browse files
committed
refactor: user page
1 parent d4b699d commit 09440cb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

client/src/pages/UsersPage.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const UsersPage = () => {
1616
});
1717

1818

19-
// SG 11/11/2022 19:52 A funciton that makes a post request to the backend to add a user
19+
// SG 11/11/2022 19:52 A function that makes a post request to the backend to add a user
2020
const handleSubmit = async (e) => {
2121
// SG 11/11/2022 19:53 checking is the input fields are empty
2222
if(!inputUser || !inputUser.username || !inputUser.profile_image || !inputUser.description) return;
@@ -25,7 +25,7 @@ const UsersPage = () => {
2525
// SG 11/11/2022 19:54 making a call
2626
await axios.post(ADD_USER_ENDPOINT, inputUser)
2727
.then(( {data} )=> {
28-
console.log(data)
28+
// server returns the new user, so adding it to the state array
2929
setUsers([...users, data])
3030
})
3131
.catch(e => console.log(e))

server/utils/create.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ CREATE TABLE IF NOT EXISTS users (
77
description VARCHAR(255) NOT NULL
88
);
99

10+
11+
1012
INSERT INTO users (username, profile_image, description) VALUES ('John', 'https://image.shutterstock.com/image-photo/stock-photo-head-shot-young-attractive-businessman-in-glasses-standing-in-modern-office-pose-for-camera-250nw-1854697390.jpg', 'Hello');
1113
INSERT INTO users (username, profile_image, description) VALUES ('Chris', 'https://miro.medium.com/max/1400/0*0fClPmIScV5pTLoE.jpg', 'Hello');
12-
INSERT INTO users (username, profile_image, description) VALUES ('Sam', 'https://www.elitesingles.co.uk/wp-content/uploads/sites/59/2019/11/2b_en_articleslide_sm2-350x264.jpg', 'Hello');
14+
INSERT INTO users (username, profile_image, description) VALUES ('Paul', 'https://www.elitesingles.co.uk/wp-content/uploads/sites/59/2019/11/2b_en_articleslide_sm2-350x264.jpg', 'Hello');

0 commit comments

Comments
 (0)