Commit 5429bda0 authored by Nawod Randima's avatar Nawod Randima

4th commit

parent c5e50a66
...@@ -79,7 +79,7 @@ axios.post("http://localhost:8080/api/emp/save", newEmp) ...@@ -79,7 +79,7 @@ axios.post("http://localhost:8080/api/emp/save", newEmp)
# request # request
axios.get(`http://localhost:8080/api/emp/all`) axios.get(`http://localhost:8080/api/emp/all`)
.then((response) => { .then((response) => {
setEmployeeData(response.data.data); setEmployeeData(response.data.data");
}) })
.catch((err) => { .catch((err) => {
alert(err); alert(err);
...@@ -105,3 +105,46 @@ axios.post("http://localhost:8080/api/emp/save", newEmp) ...@@ -105,3 +105,46 @@ axios.post("http://localhost:8080/api/emp/save", newEmp)
] ]
} }
``` ```
#### 3. Update Employee
```
# request
axios.put(`http://localhost:8080/api/emp/update/`+ id, data)
.then((response) => {
alert("Employee Successfully Updated")
})
.catch((err) => {
alert(err);
});
}
# response
{
"code": 2000,
"message": "Employee Updated",
"success": true,
"data": null
}
```
#### 4. Delete Employee
```
# request
axios.delete(`http://localhost:8080/api/emp/delete/`+ id)
.then((response) => {
alert("Employee Successfully Deleted")
})
.catch((err) => {
alert(err);
});
}
# response
{
"code": 2000,
"message": "Employee Deleted",
"success": true,
"data": null
}
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment