- fork
- clone
cd
to the foldernpm install
npm start
- Install Axios
npm install axios
- in App.js
import axios from "axios"
- a state for rooms is created for you in App.js
- in App.js create a fetchRooms function ( make sure to use : async , await, try and catch )
- fetchRooms should be triggred once App is rendered
- dont forget to setRooms based on the response
- a createRoom function has been created in App.js
- pass it to ChatRoomList component
- then pass it to CreateRoomModel component
- in CreateRoomModel a room state has been created for you
- fix the missing code in : handleChange, handleSubmit (read the comments they have hints)
- in App.js complete createRoom function ( make sure to use : async , await, try and catch )
- dont forget to add the new room to the list of rooms
- a deleteRoom function has been created in App.js
- pass it to ChatRoomList component
- then pass it to ChatRoomitem component
- in ChatRoomitem fix the missing code in : handleDelete (read the comments they have hints)
- in App.js complete deleteRoom function ( make sure to use : async , await, try and catch )
- dont forget to delete the room from the list of rooms
no steps ! its a challenge
Endpoints:
Fetch all rooms:
Endpoint: https://coded-task-axios-be.herokuapp.com/rooms
GET
Create a room:
Endpoint: https://coded-task-axios-be.herokuapp.com/rooms
Method: POST
Data required: title,image,description
Update a room:
Endpoint: https://coded-task-axios-be.herokuapp.com/rooms/${roomId}
Method: PUT
Data required: title,image,description
Delete a room:
Endpoint: https://coded-task-axios-be.herokuapp.com/rooms/${roomId}
Method: Delete
Create a msg:
Endpoint: https://coded-task-axios-be.herokuapp.com/rooms/msg/${roomId}
Method: POST
Data required: msg