Skip to content

Commit

Permalink
fix bug with prepare (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssb-jnk authored Mar 8, 2024
1 parent f6e4c40 commit e342745
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .env.declaration
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DAPLA_TEAM_API_URL=
DAPLA_TEAM_API_CLUSTER_URL=
PORT=8080
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint ./src --ext .jsx,.js,.ts,.tsx --quiet --fix --ignore-path ./.gitignore",
"lint:format": "prettier --loglevel warn --write \"./**/*.{js,jsx,ts,tsx,css,md,json}\" ",
"preview": "vite preview"
"preview": "vite preview",
"prepare": "npx vite-envs update-types"
},
"dependencies": {
"@emotion/react": "^11.11.4",
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import proxy from 'express-http-proxy'
const app = express()
const PORT = process.env.PORT || 3000
// use cluster URL if available
const DAPLA_TEAM_API_URL = process.env.DAPLA_TEAM_API_CLUSTER_URL || 'https://dapla-team-api-v2.staging-bip-app.ssb.no'
const DAPLA_TEAM_API_URL = process.env.DAPLA_TEAM_API_CLUSTER_URL || "https://dapla-team-api-v2.staging-bip-app.ssb.no"

// Proxy, note this middleware must be place before all else.. THIS TOOK ME 3 HOURS TO FIGURE OUT! TODO: Remove comment
app.use(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://vitejs.dev/config/server-options.html
// https://github.com/garronej/vite-envs

export const DAPLA_TEAM_API_URL = `http://localhost:${import.meta.env.PORT.trim()}/api`
export const DAPLA_TEAM_API_URL = `http://localhost:${import.meta.env.PORT}/api`

export const getGroupType = (groupName: string) => {
const match = groupName.match(/(managers|developers|data-admins|support|consumers)$/)
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default defineConfig({
plugins: [
react(),
viteEnvs({
declarationFile: '.env.local',
declarationFile: '.env.declaration',
}),
],
})

0 comments on commit e342745

Please sign in to comment.