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

This commit is contained in:
Resh 2024-12-11 11:25:35 +07:00
parent b2c76268f9
commit 25ffeef9f0
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'
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 {

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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 => {