Fix CFP URL so CORS is allowed
This commit is contained in:
parent
b46549485c
commit
0cd5365c93
2
.env
2
.env
|
@ -1 +1 @@
|
||||||
VITE_CFP_BASE_URL=http://cfp.localhost/api/conferences/
|
VITE_CFP_BASE_URL=https://cfp.openfest.org/api/conferences
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
VITE_CFP_BASE_URL=https://cfp.openfest.org/api/conferences
|
|
@ -2,6 +2,6 @@ import useSWR from 'swr';
|
||||||
|
|
||||||
const fetcher = (...args) => fetch(...args).then(res => res.json());
|
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);
|
return useSWR(import.meta.env.VITE_CFP_BASE_URL.concat(path), fetcher);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import useCfpRequest from './useCfpRequest.js';
|
import useCfpRequest from './useCfpRequest.js';
|
||||||
|
|
||||||
export default function useConferences() {
|
export default function useConferences() {
|
||||||
return useCfpRequest();
|
return useCfpRequest('.json');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import useCfpRequest from './useCfpRequest.js';
|
import useCfpRequest from './useCfpRequest.js';
|
||||||
|
|
||||||
export default function useEventTypes(conferenceId) {
|
export default function useEventTypes(conferenceId) {
|
||||||
return useCfpRequest(`${conferenceId}/event_types.json`);
|
return useCfpRequest(`/${conferenceId}/event_types.json`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import useCfpRequest from './useCfpRequest.js';
|
import useCfpRequest from './useCfpRequest.js';
|
||||||
|
|
||||||
export default function useEvents(conferenceId) {
|
export default function useEvents(conferenceId) {
|
||||||
return useCfpRequest(`${conferenceId}/events.json`);
|
return useCfpRequest(`/${conferenceId}/events.json`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import useCfpRequest from './useCfpRequest.js';
|
import useCfpRequest from './useCfpRequest.js';
|
||||||
|
|
||||||
export default function useHalls(conferenceId) {
|
export default function useHalls(conferenceId) {
|
||||||
return useCfpRequest(`${conferenceId}/halls.json`);
|
return useCfpRequest(`/${conferenceId}/halls.json`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import useCfpRequest from './useCfpRequest.js';
|
import useCfpRequest from './useCfpRequest.js';
|
||||||
|
|
||||||
export default function useSlots(conferenceId) {
|
export default function useSlots(conferenceId) {
|
||||||
return useCfpRequest(`${conferenceId}/slots.json`);
|
return useCfpRequest(`/${conferenceId}/slots.json`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import useCfpRequest from './useCfpRequest.js';
|
import useCfpRequest from './useCfpRequest.js';
|
||||||
|
|
||||||
export default function useSpeakers(conferenceId) {
|
export default function useSpeakers(conferenceId) {
|
||||||
return useCfpRequest(`${conferenceId}/speakers.json`);
|
return useCfpRequest(`/${conferenceId}/speakers.json`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import useCfpRequest from './useCfpRequest.js';
|
import useCfpRequest from './useCfpRequest.js';
|
||||||
|
|
||||||
export default function useTracks(conferenceId) {
|
export default function useTracks(conferenceId) {
|
||||||
return useCfpRequest(`${conferenceId}/tracks.json`);
|
return useCfpRequest(`/${conferenceId}/tracks.json`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue