Fix some cors issues
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
const isDev = import.meta.env.DEV;
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
apiUrl: isDev ? '/api' : 'https://inventory.kent.pw/api',
|
apiUrl: '/api',
|
||||||
baseUrl: isDev ? '' : 'https://inventory.kent.pw',
|
baseUrl: '',
|
||||||
authUrl: isDev ? '/auth-inv' : 'https://inventory.kent.pw/auth-inv',
|
authUrl: '/auth-inv',
|
||||||
chatUrl: isDev ? '/chat-api' : 'https://inventory.kent.pw/chat-api'
|
chatUrl: '/chat-api'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
@@ -1,15 +1,19 @@
|
|||||||
const isDev = import.meta.env.DEV;
|
const isDev = import.meta.env.DEV;
|
||||||
|
const isLocal = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
|
||||||
|
|
||||||
|
// Use proxy paths when on inventory domains to avoid CORS
|
||||||
|
const useProxy = !isLocal && (window.location.hostname === 'inventory.kent.pw' || window.location.hostname === 'inventory.acot.site');
|
||||||
|
|
||||||
const liveDashboardConfig = {
|
const liveDashboardConfig = {
|
||||||
auth: isDev ? '/dashboard-auth' : 'https://dashboard.kent.pw/auth',
|
auth: isDev || useProxy ? '/dashboard-auth' : 'https://dashboard.kent.pw/auth',
|
||||||
aircall: isDev ? '/api/aircall' : 'https://dashboard.kent.pw/api/aircall',
|
aircall: isDev || useProxy ? '/api/aircall' : 'https://dashboard.kent.pw/api/aircall',
|
||||||
klaviyo: isDev ? '/api/klaviyo' : 'https://dashboard.kent.pw/api/klaviyo',
|
klaviyo: isDev || useProxy ? '/api/klaviyo' : 'https://dashboard.kent.pw/api/klaviyo',
|
||||||
meta: isDev ? '/api/meta' : 'https://dashboard.kent.pw/api/meta',
|
meta: isDev || useProxy ? '/api/meta' : 'https://dashboard.kent.pw/api/meta',
|
||||||
gorgias: isDev ? '/api/gorgias' : 'https://dashboard.kent.pw/api/gorgias',
|
gorgias: isDev || useProxy ? '/api/gorgias' : 'https://dashboard.kent.pw/api/gorgias',
|
||||||
analytics: isDev ? '/api/dashboard-analytics' : 'https://dashboard.kent.pw/api/analytics',
|
analytics: isDev || useProxy ? '/api/dashboard-analytics' : 'https://dashboard.kent.pw/api/analytics',
|
||||||
typeform: isDev ? '/api/typeform' : 'https://dashboard.kent.pw/api/typeform',
|
typeform: isDev || useProxy ? '/api/typeform' : 'https://dashboard.kent.pw/api/typeform',
|
||||||
acot: isDev ? '/api/acot' : 'https://dashboard.kent.pw/api/acot',
|
acot: isDev || useProxy ? '/api/acot' : 'https://dashboard.kent.pw/api/acot',
|
||||||
clarity: isDev ? '/api/clarity' : 'https://dashboard.kent.pw/api/clarity'
|
clarity: isDev || useProxy ? '/api/clarity' : 'https://dashboard.kent.pw/api/clarity'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default liveDashboardConfig;
|
export default liveDashboardConfig;
|
||||||
Reference in New Issue
Block a user