diff --git a/.env.local b/.env.local new file mode 100644 index 0000000..e5266ca --- /dev/null +++ b/.env.local @@ -0,0 +1 @@ +VITE_API_HOST=http://localhost:3000 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 09d55b9..aa56e0b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -54,7 +54,7 @@ jobs: name: Build Vite frontend for production with bun runtime env: ## This is the URL the Solid app will use to make API calls - VITE_API_URL: https://norsky.snorre.io + VITE_API_HOST: https://norsky.snorre.io run: bun run build diff --git a/frontend/App.tsx b/frontend/App.tsx index cdd578c..1a4d6a4 100644 --- a/frontend/App.tsx +++ b/frontend/App.tsx @@ -14,7 +14,7 @@ import 'chartjs-adapter-date-fns'; import icon from "../assets/favicon.png"; // Get the URL from the import.meta object -const url = import.meta.env.BASE_URL; +const host = import.meta.env.VITE_API_HOST; const mapData = (data: any) => { const mapped = data?.map(({ time, count }: any) => ({ x: time, y: count })).slice(data.length - 24, data.length)?? [] @@ -121,7 +121,7 @@ const PostPerHour: Component<{ lang: string, label: string }> = ({ lang, label } // Create a new resource signal to fetch data from the API // That is createResource('http://localhost:3000/dashboard/posts-per-hour'); const [data] = createResource( - `http://localhost:3000/dashboard/posts-per-hour?lang=${lang}`, + `${host}/dashboard/posts-per-hour?lang=${lang}`, fetcher ); return ( diff --git a/postcss.config.js b/postcss.config.js index 4be1640..5d74a80 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,5 +1,5 @@ module.exports = { - purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], + purge: ['./index.html', './frontend/**/*.{vue,js,ts,jsx,tsx}'], plugins: { tailwindcss: {}, autoprefixer: {}, diff --git a/tailwind.config.ts b/tailwind.config.ts index b9a57b3..2f45a34 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -3,7 +3,7 @@ import type { Config } from 'tailwindcss'; const config: Config = { content: [ './index.html', - './src/**/*.{js,ts,jsx,tsx,css,md,mdx,html,json,scss}', + './frontend/**/*.{js,ts,jsx,tsx,css,md,mdx,html,json,scss}', ], darkMode: 'class', theme: {