diff --git a/src/roles/user/dashboard/services/dashboardService.jsx b/src/roles/user/dashboard/services/dashboardService.jsx index 379c7ae..93b0bde 100644 --- a/src/roles/user/dashboard/services/dashboardService.jsx +++ b/src/roles/user/dashboard/services/dashboardService.jsx @@ -1,8 +1,13 @@ +/* eslint-disable no-useless-catch */ import axiosInstance from '../../../../utils/axiosInstance' const fetchJourney = async () => { - const response = await axiosInstance.get(`/topic/complete`) - return response.data + try { + const response = await axiosInstance.get(`/topic/complete`) + return response.data + } catch (error) { + throw error + } } export default { diff --git a/src/roles/user/history/services/historyService.jsx b/src/roles/user/history/services/historyService.jsx index 4c469d4..312a37f 100644 --- a/src/roles/user/history/services/historyService.jsx +++ b/src/roles/user/history/services/historyService.jsx @@ -1,3 +1,4 @@ +/* eslint-disable no-useless-catch */ import axiosInstance from '../../../../utils/axiosInstance' const fetchTopic = async () => { @@ -5,7 +6,6 @@ const fetchTopic = async () => { const response = await axiosInstance.get(`/topic`) return response.data } catch (error) { - console.error(error) throw error } } @@ -24,7 +24,6 @@ const fetchAllHistory = async () => { status: response.data.statusCode, } } catch (error) { - console.error(error) throw error } } diff --git a/src/roles/user/review/services/reviewService.jsx b/src/roles/user/review/services/reviewService.jsx index 6812076..bd25002 100644 --- a/src/roles/user/review/services/reviewService.jsx +++ b/src/roles/user/review/services/reviewService.jsx @@ -1,9 +1,11 @@ +/* eslint-disable no-useless-catch */ +/* eslint-disable no-unused-vars */ import axiosInstance from '../../../../utils/axiosInstance' -// const getSoalNumber = (title) => { -// const match = title.match(/\d+$/); -// return match ? parseInt(match[0], 10) : 0; -// }; +const getSoalNumber = title => { + const match = title.match(/\d+$/) + return match ? parseInt(match[0], 10) : 0 +} const getLevelId = async (topicId, levelName) => { try { @@ -33,7 +35,6 @@ const fetchReview = async stdLearning => { return response.data } catch (error) { - console.error('Error fetching review:', error) throw error } } @@ -43,7 +44,6 @@ const submitAnswer = async dataAnswer => { const response = await axiosInstance.post(`/stdExercise`, dataAnswer) return response.data } catch (error) { - console.error('Error submit exercise:', error) throw error } } diff --git a/src/utils/Constant.jsx b/src/utils/Constant.jsx index 3b228bd..82c9f31 100644 --- a/src/utils/Constant.jsx +++ b/src/utils/Constant.jsx @@ -1,3 +1,4 @@ +/* eslint-disable no-useless-escape */ export const API_URL = 'https://z30xrgl5-3001.asse.devtunnels.ms/api' export const MEDIA_URL = 'https://z30xrgl5-3001.asse.devtunnels.ms/api/uploads' @@ -15,8 +16,8 @@ export const slugify = text => { .toLowerCase() .trim() .replace(/\s+/g, '-') - .replace(/[^\w-]+/g, '') - .replace(/--+/g, '-') + .replace(/[^\w\-]+/g, '') + .replace(/\-\-+/g, '-') } export const unSlugify = text => {