Skip to content

Commit

Permalink
merge conflict solved
Browse files Browse the repository at this point in the history
  • Loading branch information
rkshaon committed Nov 29, 2024
2 parents a8ce512 + 5be4691 commit 0bce3df
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
22 changes: 10 additions & 12 deletions frontend/src/services/v1/genreAPIService.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
// src/services/v1/genreAPIService.js

import axios from 'axios'
import api from '@/services/axiosInstance'

const API_BASE_URL = process.env.VUE_APP_BACKEND_URL
const content = 'genre'
const version = 'v1'

export default {
async fetchV1GenreDetails (id = null) {
const URL = `${API_BASE_URL}/book/${version}/${content}/${id}/`
console.log('Genre Details API:', URL)
export const fetchV1GenreDetails = async (id = null) => {
const URL = `${API_BASE_URL}/book/${version}/${content}/${id}/`
console.log('Genre Details API:', URL)

try {
const response = await axios.get(URL)
return response.data
} catch (error) {
console.error('Error fetching genre:', error)
throw error
}
try {
const response = await api.get(URL)
return response.data
} catch (error) {
console.error('Error fetching genre:', error)
throw error
}
}
22 changes: 10 additions & 12 deletions frontend/src/services/v1/topicAPIService.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
// src/services/v1/topicAPIService.js

import axios from 'axios'
import api from '@/services/axiosInstance'

const API_BASE_URL = process.env.VUE_APP_BACKEND_URL
const content = 'topic'
const version = 'v1'

export default {
async fetchV1TopicDetails (id = null) {
const URL = `${API_BASE_URL}/book/${version}/${content}/${id}/`
console.log('topic Details API:', URL)
export const fetchV1TopicDetails = async (id = null) => {
const URL = `${API_BASE_URL}/book/${version}/${content}/${id}/`
console.log('topic Details API:', URL)

try {
const response = await axios.get(URL)
return response.data
} catch (error) {
console.error('Error fetching topic:', error)
throw error
}
try {
const response = await api.get(URL)
return response.data
} catch (error) {
console.error('Error fetching topic:', error)
throw error
}
}
4 changes: 2 additions & 2 deletions frontend/src/store/modules/genres/genreDetails.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/store/modules/genreDetails.js

import genreAPIService from '@/services/v1/genreAPIService'
import { fetchV1GenreDetails } from '@/services/v1/genreAPIService'

export default {
state: {
Expand Down Expand Up @@ -29,7 +29,7 @@ export default {
commit('SET_LOADING', true)
commit('SET_ERROR', null)
try {
const response = await genreAPIService.fetchV1GenreDetails(genreId)
const response = await fetchV1GenreDetails(genreId)
commit('SET_GENRE_DETAILS', response)
} catch (error) {
const errorMessages = []
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/modules/topics/topicDetails.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/store/modules/topicDetails.js

import topicAPIService from '@/services/v1/topicAPIService'
import { fetchV1TopicDetails } from '@/services/v1/topicAPIService'

export default {
state: {
Expand Down Expand Up @@ -29,7 +29,7 @@ export default {
commit('SET_LOADING', true)
commit('SET_ERROR', null)
try {
const response = await topicAPIService.fetchV1TopicDetails(topicId)
const response = await fetchV1TopicDetails(topicId)
commit('SET_TOPIC_DETAILS', response)
} catch (error) {
const errorMessages = []
Expand Down

0 comments on commit 0bce3df

Please sign in to comment.