Merge branch 'refactor/multiple-service' into 'master'

refactor: restore previous try-catch and added disabled eslint rules in multiple services

See merge request profile-image/kedaireka/polinema-adapative-learning/frontend-adaptive-learning!3
This commit is contained in:
Naresh Pratista 2024-12-11 04:28:12 +00:00
commit e4fd0596a0
4 changed files with 17 additions and 12 deletions

View File

@ -1,8 +1,13 @@
/* eslint-disable no-useless-catch */
import axiosInstance from '../../../../utils/axiosInstance' import axiosInstance from '../../../../utils/axiosInstance'
const fetchJourney = async () => { const fetchJourney = async () => {
try {
const response = await axiosInstance.get(`/topic/complete`) const response = await axiosInstance.get(`/topic/complete`)
return response.data return response.data
} catch (error) {
throw error
}
} }
export default { export default {

View File

@ -1,3 +1,4 @@
/* eslint-disable no-useless-catch */
import axiosInstance from '../../../../utils/axiosInstance' import axiosInstance from '../../../../utils/axiosInstance'
const fetchTopic = async () => { const fetchTopic = async () => {
@ -5,7 +6,6 @@ const fetchTopic = async () => {
const response = await axiosInstance.get(`/topic`) const response = await axiosInstance.get(`/topic`)
return response.data return response.data
} catch (error) { } catch (error) {
console.error(error)
throw error throw error
} }
} }
@ -24,7 +24,6 @@ const fetchAllHistory = async () => {
status: response.data.statusCode, status: response.data.statusCode,
} }
} catch (error) { } catch (error) {
console.error(error)
throw error throw error
} }
} }

View File

@ -1,9 +1,11 @@
/* eslint-disable no-useless-catch */
/* eslint-disable no-unused-vars */
import axiosInstance from '../../../../utils/axiosInstance' import axiosInstance from '../../../../utils/axiosInstance'
// const getSoalNumber = (title) => { const getSoalNumber = title => {
// const match = title.match(/\d+$/); const match = title.match(/\d+$/)
// return match ? parseInt(match[0], 10) : 0; return match ? parseInt(match[0], 10) : 0
// }; }
const getLevelId = async (topicId, levelName) => { const getLevelId = async (topicId, levelName) => {
try { try {
@ -33,7 +35,6 @@ const fetchReview = async stdLearning => {
return response.data return response.data
} catch (error) { } catch (error) {
console.error('Error fetching review:', error)
throw error throw error
} }
} }
@ -43,7 +44,6 @@ const submitAnswer = async dataAnswer => {
const response = await axiosInstance.post(`/stdExercise`, dataAnswer) const response = await axiosInstance.post(`/stdExercise`, dataAnswer)
return response.data return response.data
} catch (error) { } catch (error) {
console.error('Error submit exercise:', error)
throw error throw error
} }
} }

View File

@ -1,3 +1,4 @@
/* eslint-disable no-useless-escape */
export const API_URL = 'https://z30xrgl5-3001.asse.devtunnels.ms/api' export const API_URL = 'https://z30xrgl5-3001.asse.devtunnels.ms/api'
export const MEDIA_URL = 'https://z30xrgl5-3001.asse.devtunnels.ms/api/uploads' export const MEDIA_URL = 'https://z30xrgl5-3001.asse.devtunnels.ms/api/uploads'
@ -15,8 +16,8 @@ export const slugify = text => {
.toLowerCase() .toLowerCase()
.trim() .trim()
.replace(/\s+/g, '-') .replace(/\s+/g, '-')
.replace(/[^\w-]+/g, '') .replace(/[^\w\-]+/g, '')
.replace(/--+/g, '-') .replace(/\-\-+/g, '-')
} }
export const unSlugify = text => { export const unSlugify = text => {