Skip to content

Commit

Permalink
frontend: Making backend URL configurable via env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrings committed Feb 13, 2024
1 parent 8e76810 commit fca92f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions apps/rasptherm/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_BACKEND_URL: string;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
}
2 changes: 1 addition & 1 deletion apps/rasptherm/src/store/sensor.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const initialSensorState: SensorState = {

export const readSensor = createAsyncThunk('sensor/read', async () => {
const client = new RaspthermClient({
BASE: 'http://localhost:8000',
BASE: import.meta.env.VITE_BACKEND_URL,
});

const readout = await client.sensor.readSensorSensorReadGet();
Expand Down

0 comments on commit fca92f2

Please sign in to comment.