refactor: update translation API and improve footer component logic
This commit is contained in:
22
layers/composables/useApiData.ts
Normal file
22
layers/composables/useApiData.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
interface ReqApiData {
|
||||
baseApiUrl: string
|
||||
url: string
|
||||
}
|
||||
|
||||
export const useApiData = async (req: ReqApiData): Promise<any> => {
|
||||
const dataUrl = `${req.baseApiUrl}/${req.url}` // 정상 URL 경로
|
||||
try {
|
||||
const fetch = await $fetch<any>(dataUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
return fetch
|
||||
} catch (error) {
|
||||
console.log('error', error)
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user