-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
☘️ [Frontend] Integrate Get Testimonials API with frontend (#1041)
* Integrate Get Testimonials API with frontend * Updated Testimonial.jsx --------- Co-authored-by: kajol <[email protected]>
- Loading branch information
1 parent
ce35ae3
commit 66c50b2
Showing
4 changed files
with
115 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
frontend/src/pages/Home/components/Testimonials/testimonials.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { END_POINT } from "../config/api"; | ||
import { showToast } from "./toastService"; | ||
|
||
export async function getTestimonials(setTestimonials, setToast) { | ||
try { | ||
const response = await fetch(`${END_POINT}/testimonials/getTestimonials`, { | ||
method: "GET", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
|
||
if (response.ok) { | ||
const data = await response.json(); | ||
setTestimonials(data); | ||
// we won't be showing the success message for this as it looks wierd on the home page. | ||
} else { | ||
showToast(setToast, "Failed to fetch testimonials.", "error"); | ||
} | ||
} catch (err) { | ||
console.error("Network Error:", err); | ||
showToast(setToast, "Network Error", "error"); | ||
} | ||
}; | ||
|