Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scheduler-react-sample
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linh Nguyen
scheduler-react-sample
Commits
cc4aaedf
Commit
cc4aaedf
authored
Jun 19, 2020
by
Jiawen Lyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete a user
parent
2b3cc3df
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
9 deletions
+35
-9
src/App.js
src/App.js
+10
-1
src/HOC/withFetchData.js
src/HOC/withFetchData.js
+1
-1
src/components/LoginInput.js
src/components/LoginInput.js
+1
-2
src/components/StudentsList.js
src/components/StudentsList.js
+23
-5
No files found.
src/App.js
View file @
cc4aaedf
...
...
@@ -54,6 +54,12 @@ class App extends Component {
})
}
deleteLogin
=
(
login
)
=>
{
this
.
setState
({
logins
:
this
.
state
.
logins
.
filter
(
elem
=>
elem
!==
login
)
})
}
render
()
{
const
{
currentTimeFormatState
,
messages
,
logins
}
=
this
.
state
;
return
(
...
...
@@ -85,7 +91,10 @@ class App extends Component {
<
label
for
=
"
exampleInputEmail1
"
>
Current
students
:
<
/label
>
<
/div
>
<
div
class
=
"
row
"
>
<
StudentsList
logins
=
{
logins
}
/
>
<
StudentsList
logins
=
{
logins
}
handleClick
=
{(
this
.
deleteLogin
)}
/
>
<
/div
>
<
/div
>
...
...
src/HOC/withFetchData.js
View file @
cc4aaedf
...
...
@@ -16,7 +16,7 @@ export default WrappedComponent => {
handleFetchPromises
=
()
=>
{
const
fetchPromises
=
this
.
props
.
logins
.
map
(
login
=>
{
return
fetch
(
`https://webapplis.utc.fr/Edt_ent_rest/myedt/result/?login=
${
login
}
`
)
return
fetch
(
`https://
corsanywhere.herokuapp.com/https://
webapplis.utc.fr/Edt_ent_rest/myedt/result/?login=
${
login
}
`
)
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
(
res
.
map
(
elem
=>
({
...
...
src/components/LoginInput.js
View file @
cc4aaedf
...
...
@@ -28,8 +28,7 @@ export const LoginInput = (props) => {
onClick
=
{(
e
)
=>
{
e
.
preventDefault
();
props
.
handleClick
(
inputValue
.
value
)
}
}
}}
>
Submit
<
/button
>
...
...
src/components/StudentsList.js
View file @
cc4aaedf
...
...
@@ -7,11 +7,29 @@ export const StudentsList = (props) => {
<>
<
ul
class
=
"
list-group
"
id
=
"
studentList
"
>
{
logins
.
map
(
login
=>
(
<
li
class
=
"
list-group-item
"
key
=
{
login
}
>
{
login
}
<
/li>
)
)
logins
.
map
(
login
=>
(
<
div
class
=
"
row
"
>
<
li
class
=
"
list-group-item
"
key
=
{
login
}
>
{
login
}
<
/li
>
<
button
type
=
"
button
"
class
=
"
close
"
aria
-
label
=
"
Close
"
onClick
=
{(
e
)
=>
{
e
.
preventDefault
();
props
.
handleClick
(
login
)
}}
>
<
span
aria
-
hidden
=
"
true
"
>&
times
;
<
/span
>
<
/button
>
<
/div
>
))
}
<
/ul
>
<
/
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment