This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
// composables/useApi.js
|
||||
import { ref } from 'vue'
|
||||
|
||||
function normalizeUrl(url: string): string {
|
||||
return url.replace(/\/+$/, '')
|
||||
}
|
||||
|
||||
export default function useApi() {
|
||||
const config = useRuntimeConfig()
|
||||
const baseUrl = config.public.apiBaseUrl
|
||||
const baseUrl = `${normalizeUrl(config.public.apiBaseUrl)}/api`
|
||||
|
||||
// Generic GET request
|
||||
const get = async (endpoint) => {
|
||||
|
||||
Reference in New Issue
Block a user