| No |
- Level |
+ Section |
Topic |
Level |
Action |
@@ -82,25 +82,27 @@ const ManageMaterials = () => {
):(
- levels.map((level, index) => (
-
- | {index + 1} |
- {level.NAME_SECTION} |
- {level.NAME_TOPIC} |
- {level.NAME_LEVEL} |
-
- {/* */}
-
-
-
- {/* */}
+ levels.length > 0 ?(
+ levels.map((level, index) => (
+ |
+ | {index + 1} |
+ {level.NAME_SECTION} |
+ {level.NAME_TOPIC} |
+ {level.NAME_LEVEL} |
+
+
+
+
+ |
+
+ ))
+ ):(
+
+
+ Empty Data
|
- ))
+ )
)}
diff --git a/src/roles/admin/manage_section/hooks/useSections.jsx b/src/roles/admin/manage_section/hooks/useSections.jsx
index 6094b46..967abd8 100644
--- a/src/roles/admin/manage_section/hooks/useSections.jsx
+++ b/src/roles/admin/manage_section/hooks/useSections.jsx
@@ -68,15 +68,20 @@ const useSections = () => {
try {
const createdSection = await sectionService.createData(createData);
setSections((prevSections) => [...prevSections, createdSection.payload]);
- } catch (err) {
- setError(err);
- }finally{
resetForm();
setLoaderState(prev => ({
...prev,
loading: false,
successMessage: 'Your new entry has been successfully created and saved.'
}));
+ } catch (err) {
+ setError(err);
+ setLoaderState(prev => ({
+ ...prev,
+ title: "ERROR",
+ loading: false,
+ successMessage: err.message
+ }));
}
};
diff --git a/src/roles/admin/manage_section/views/ManageSections.jsx b/src/roles/admin/manage_section/views/ManageSections.jsx
index ef025b1..7209737 100644
--- a/src/roles/admin/manage_section/views/ManageSections.jsx
+++ b/src/roles/admin/manage_section/views/ManageSections.jsx
@@ -95,21 +95,29 @@ const ManageSections = () => {
):(
- sections.map((section, index) => (
-
- | {index + 1} |
- {section.NAME_SECTION} |
- {section.DESCRIPTION_SECTION} |
-
-
-
+ sections.length > 0 ?(
+ sections.map((section, index) => (
+ |
+ | {index + 1} |
+ {section.NAME_SECTION} |
+ {section.DESCRIPTION_SECTION} |
+
+
+
+ |
+
+ ))
+ ):(
+
+
+ Empty Data
|
- ))
+ )
)}
diff --git a/src/roles/admin/manage_students/views/ManageStudents.jsx b/src/roles/admin/manage_students/views/ManageStudents.jsx
index fcc0df6..6201b62 100644
--- a/src/roles/admin/manage_students/views/ManageStudents.jsx
+++ b/src/roles/admin/manage_students/views/ManageStudents.jsx
@@ -130,7 +130,7 @@ const ManageStudents = () => {
{student.NISN} |
{student.NAME_USERS} |
{student.EMAIL} |
-
+ |
diff --git a/src/roles/admin/manage_teachers/views/ManageTeachers.jsx b/src/roles/admin/manage_teachers/views/ManageTeachers.jsx
index af8c3a5..327cc8a 100644
--- a/src/roles/admin/manage_teachers/views/ManageTeachers.jsx
+++ b/src/roles/admin/manage_teachers/views/ManageTeachers.jsx
@@ -130,7 +130,7 @@ const ManageTeachers = () => {
| {teacher.NIP} |
{teacher.NAME_USERS} |
{teacher.EMAIL} |
-
+ |
diff --git a/src/roles/admin/manage_topics/hooks/useTopics.jsx b/src/roles/admin/manage_topics/hooks/useTopics.jsx
index c1be56d..0bbf05f 100644
--- a/src/roles/admin/manage_topics/hooks/useTopics.jsx
+++ b/src/roles/admin/manage_topics/hooks/useTopics.jsx
@@ -74,16 +74,21 @@ const useTopics = () => {
DESCRIPTION_TOPIC: data.description,
};
const createdTopic = await topicService.createData(newTopic);
- setTopics((prevTopics) => [...prevTopics, createdTopic.payload]);
- } catch (err) {
- setError(err);
- }finally{
+ setTopics((prevTopics) => [...prevTopics, createdTopic.payload.topic]);
resetForm();
setLoaderState(prev => ({
...prev,
loading: false,
successMessage: 'Your new entry has been successfully created and saved.'
}));
+ } catch (err) {
+ setError(err);
+ setLoaderState(prev => ({
+ ...prev,
+ title: "ERROR",
+ loading: false,
+ successMessage: err.message
+ }));
}
};
diff --git a/src/roles/admin/manage_topics/services/serviceTopics.jsx b/src/roles/admin/manage_topics/services/serviceTopics.jsx
index c4d1fc7..082ebdb 100644
--- a/src/roles/admin/manage_topics/services/serviceTopics.jsx
+++ b/src/roles/admin/manage_topics/services/serviceTopics.jsx
@@ -22,10 +22,10 @@ const fetchDataSection = async () => {
const getTopicById = async (id) => {
try {
- const response = await axiosInstance.get(`/${id}`);
+ const response = await axiosInstance.get(`/topic/${id}`);
return response.data;
} catch (error) {
- console.error(`Error fetching topic with ID ${id}:`, error);
+ console.error(`Error get topic with ID ${id}:`, error);
throw error;
}
};
diff --git a/src/roles/admin/manage_topics/views/ManageTopics.jsx b/src/roles/admin/manage_topics/views/ManageTopics.jsx
index 41d0f0c..f9c62a7 100644
--- a/src/roles/admin/manage_topics/views/ManageTopics.jsx
+++ b/src/roles/admin/manage_topics/views/ManageTopics.jsx
@@ -99,21 +99,29 @@ const ManageTopics = () => {
|
):(
- topics.map((topic, index) => (
-
- | {index + 1} |
- {sectionSlug[topic.ID_SECTION]} |
- {topic.NAME_TOPIC} |
-
-
-
+ topics.length > 0 ?(
+ topics.map((topic, index) => (
+ |
+ | {index + 1} |
+ {sectionSlug[topic.ID_SECTION]} |
+ {topic.NAME_TOPIC} |
+
+
+
+ |
+
+ ))
+ ):(
+
+
+ Empty Data
|
- ))
+ )
)}
diff --git a/src/roles/admin/setting/hooks/useSettings.jsx b/src/roles/admin/setting/hooks/useSettings.jsx
index c9235f4..748b80e 100644
--- a/src/roles/admin/setting/hooks/useSettings.jsx
+++ b/src/roles/admin/setting/hooks/useSettings.jsx
@@ -16,6 +16,7 @@ const useSettings = () => {
const fetchData = async () => {
try {
const data = await settingService.fetchProfile();
+ console.log(data);
setProfile(data.payload);
setIdUser(data.payload.ID)
} catch (err) {