diff --git a/.env b/.env index 6a20770..2434d82 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -VITE_CFP_BASE_URL=http://cfp.localhost/api/conferences/ +VITE_CFP_BASE_URL=https://cfp.openfest.org/api/conferences diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..2434d82 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +VITE_CFP_BASE_URL=https://cfp.openfest.org/api/conferences diff --git a/src/hooks/useCfpRequest.js b/src/hooks/useCfpRequest.js index a2945a8..9c3e8a3 100644 --- a/src/hooks/useCfpRequest.js +++ b/src/hooks/useCfpRequest.js @@ -2,6 +2,6 @@ import useSWR from 'swr'; const fetcher = (...args) => fetch(...args).then(res => res.json()); -export default function useCfpRequest(path = '') { +export default function useCfpRequest(path) { return useSWR(import.meta.env.VITE_CFP_BASE_URL.concat(path), fetcher); } diff --git a/src/hooks/useConferences.js b/src/hooks/useConferences.js index ca45c2a..6a8edda 100644 --- a/src/hooks/useConferences.js +++ b/src/hooks/useConferences.js @@ -1,5 +1,5 @@ import useCfpRequest from './useCfpRequest.js'; export default function useConferences() { - return useCfpRequest(); + return useCfpRequest('.json'); } diff --git a/src/hooks/useEventTypes.js b/src/hooks/useEventTypes.js index 2ed66ba..cba4acc 100644 --- a/src/hooks/useEventTypes.js +++ b/src/hooks/useEventTypes.js @@ -1,5 +1,5 @@ import useCfpRequest from './useCfpRequest.js'; export default function useEventTypes(conferenceId) { - return useCfpRequest(`${conferenceId}/event_types.json`); + return useCfpRequest(`/${conferenceId}/event_types.json`); } diff --git a/src/hooks/useEvents.js b/src/hooks/useEvents.js index d72857f..e1c5881 100644 --- a/src/hooks/useEvents.js +++ b/src/hooks/useEvents.js @@ -1,5 +1,5 @@ import useCfpRequest from './useCfpRequest.js'; export default function useEvents(conferenceId) { - return useCfpRequest(`${conferenceId}/events.json`); + return useCfpRequest(`/${conferenceId}/events.json`); } diff --git a/src/hooks/useHalls.js b/src/hooks/useHalls.js index 7d46c9a..7f9a315 100644 --- a/src/hooks/useHalls.js +++ b/src/hooks/useHalls.js @@ -1,5 +1,5 @@ import useCfpRequest from './useCfpRequest.js'; export default function useHalls(conferenceId) { - return useCfpRequest(`${conferenceId}/halls.json`); + return useCfpRequest(`/${conferenceId}/halls.json`); } diff --git a/src/hooks/useSlots.js b/src/hooks/useSlots.js index 19f9f11..112fd36 100644 --- a/src/hooks/useSlots.js +++ b/src/hooks/useSlots.js @@ -1,5 +1,5 @@ import useCfpRequest from './useCfpRequest.js'; export default function useSlots(conferenceId) { - return useCfpRequest(`${conferenceId}/slots.json`); + return useCfpRequest(`/${conferenceId}/slots.json`); } diff --git a/src/hooks/useSpeakers.js b/src/hooks/useSpeakers.js index 8503128..fee2eb1 100644 --- a/src/hooks/useSpeakers.js +++ b/src/hooks/useSpeakers.js @@ -1,5 +1,5 @@ import useCfpRequest from './useCfpRequest.js'; export default function useSpeakers(conferenceId) { - return useCfpRequest(`${conferenceId}/speakers.json`); + return useCfpRequest(`/${conferenceId}/speakers.json`); } diff --git a/src/hooks/useTracks.js b/src/hooks/useTracks.js index 90c6d27..6983a03 100644 --- a/src/hooks/useTracks.js +++ b/src/hooks/useTracks.js @@ -1,5 +1,5 @@ import useCfpRequest from './useCfpRequest.js'; export default function useTracks(conferenceId) { - return useCfpRequest(`${conferenceId}/tracks.json`); + return useCfpRequest(`/${conferenceId}/tracks.json`); }