Feedback & FAQ Systems
Feedback System
The Feedback system is designed to capture user inquiries and suggestions directly from the public-facing Contact Us page. It facilitates communication between campus visitors and administration by storing messages in the backend database.
User Interface: ContactUsPage
The ContactUsPage component provides a pre-configured form and an interactive map.
Usage: Users fill out a form containing:
- Full Name: The sender's name.
- Email: The sender's contact email.
- Contact No: A phone number for follow-ups.
- Message: The specific inquiry or feedback.
The component uses addNewFeedback to send data to the API and triggers a success toast notification upon completion.
Feedback API Reference
Located in src/Screens/cmsScreen/cms-components/Feedback/feedbackApi.js.
addNewFeedback(data)
Sends a new feedback entry to the server. This is a public-facing function.
- Input:
{ fullName: string, email: string, contactNo: string, message: string } - Returns:
Promise<Object>(The created feedback object).
Frequently Asked Questions (FAQ) System
The FAQ system provides a dynamic way to display common queries to users. It features an accordion-style interface where only one question is expanded at a time to maintain a clean layout.
User Interface: FaqPage
The FaqPage component automatically fetches all FAQ items but only renders those that have been marked as active by an administrator.
Key Features:
- Dynamic Fetching: Loads content via
getAllFaq. - Filtering: Only displays items where
status === true. - Interactive Accordion: Users can toggle answers by clicking on the question.
- Fallback Link: Provides a direct link to the Contact page if the user's question isn't listed.
FAQ API Reference
Located in src/Screens/cmsScreen/cms-components/cms-faq/faqApi.js.
| Function | Method | Description | Auth Required |
| :--- | :--- | :--- | :--- |
| getAllFaq() | GET | Retrieves all FAQ items. | No |
| getFaqById(id) | GET | Retrieves a single FAQ by ID. | No |
| addFaq(data) | POST | Creates a new FAQ entry. | Yes |
| updateFaqById(id, data) | PATCH | Updates an existing FAQ. | Yes |
| deleteFaq(id) | DELETE | Removes an FAQ entry. | Yes |
Administrative Management (CMS)
While the public consumes this data, the management logic resides within the CMS (Private Routes).
Authentication Requirements
Administrative actions (Add, Update, Delete) require a valid Bearer Token. The template automatically handles this via a helper function that retrieves the authToken from localStorage:
const getAuthToken = () => localStorage.getItem("authToken");
// Example of an authenticated header used in these APIs:
const headers = {
Authorization: `Bearer ${getAuthToken()}`,
};
Managing FAQ Visibility
To hide an FAQ from the public site without deleting it, update the item's status field to false via the updateFaqById API. The FaqPage component will automatically filter it out from the display.
Viewing Feedback
Administrators can use getAllFeedbacks() to retrieve a list of all user submissions for review within the CMS dashboard. This endpoint is typically restricted to users with administrative roles.