diff --git a/src/pages/Watchhistory.jsx b/src/pages/Watchhistory.jsx
index 7a1fc33..8ad7449 100644
--- a/src/pages/Watchhistory.jsx
+++ b/src/pages/Watchhistory.jsx
@@ -1,9 +1,28 @@
import { faHouse, faTrash } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import React from 'react';
+import React, { useEffect } from 'react';
import { Link } from 'react-router-dom';
function Watchhistory() {
+ const [allHisPlaylist, setallHisPlaylist] = useState([])
+
+ const getAllHistory = async()=>{
+ const result = await getAudiobookHistoryApi()
+ setallHisPlaylist(result.data);
+
+ }
+
+ console.log(allHisPlaylist);
+
+ const handleDelete = async(id)=>{
+ const result = await deleteHistoryAudiobookApi(id)
+ console.log(result);
+
+ }
+
+ useEffect(()=>{
+ getAllHistory()
+ },[])
return (
@@ -18,7 +37,7 @@ function Watchhistory() {
-
+ {allHisPlaylist?.length>0?
| SL.NO |
@@ -29,20 +48,24 @@ function Watchhistory() {
-
+ {allHisPlaylist?.map((item)=>(
+
| 1 |
dummy |
dummy |
dummy |
- |
+ ))
+ }
- History Cleared
+ :
+ History Cleared
}
diff --git a/src/services/allApi.js b/src/services/allApi.js
index 13107ff..11d3371 100644
--- a/src/services/allApi.js
+++ b/src/services/allApi.js
@@ -4,4 +4,20 @@ import {serverurl} from "./serverurl"
export const AddCategoryApi = async(reqbody)=>{
return await commonApi('POST',`${serverurl}/category`,reqbody)
- }
\ No newline at end of file
+ }
+
+ //add audiobook history
+
+ export const addAudiobookHistoryApi = async(reqBody)=>{
+ return await commonApi('POST',`${serverurl}/history`,reqBody)
+}
+
+// get audiobook from history
+export const getAudiobookHistoryApi = async()=>{
+ return await commonApi('GET',`${serverurl}/history`)
+}
+
+//delete audiobook from history
+export const deleteHistoryAudiobookApi = async(id)=>{
+ return await commonApi('DELETE',`${serverurl}/history/${id}`)
+}
\ No newline at end of file