Skip to content

Commit

Permalink
Updates: removed errors from console, added dynamic env params, added…
Browse files Browse the repository at this point in the history
… static config file
  • Loading branch information
jgstorey committed Sep 25, 2023
1 parent dd130e7 commit ca70ba8
Show file tree
Hide file tree
Showing 14 changed files with 608 additions and 150 deletions.
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "msedge",
"request": "launch",
"name": "Launch Edge against localhost",
"url": "http://localhost:8082",
"webRoot": "${workspaceFolder}/frontend/src/*"
}
]
}
1 change: 0 additions & 1 deletion frontend/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# base-level env settings
VITE_APP_API_ROOT=http://localhost:8080
VITE_APP_TITLE=Operating Funding Model

1 change: 1 addition & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</head>
<body>
<div id="app"></div>
<script src="/js/config/config.js"></script>
<script type="module" src="/src/main.js"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions frontend/public/js/config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// eslint-disable-next-line no-unused-vars
var config = {
BANNER_ENVIRONMENT: 'DEV',
BANNER_COLOR: '#8d28d7'
}
1 change: 1 addition & 0 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default {
},
methods: {
...mapActions(useAppStore, ['getConfig']),
...mapActions(useAuthStore, ['getJwtToken']),
handleWebSocket() {
if (this.isAuthenticated && this.isAuthorizedWebsocketUser) {
this.$webSocketsConnect()
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/common/staticConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// eslint-disable-next-line
const StaticConfig = config
export default StaticConfig
6 changes: 3 additions & 3 deletions frontend/src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export default {
}
},
created() {
useAuthStore().getUserInfo().then(() => {
this.user = this.userInfo;
});
useAuthStore().getUserInfo().then(() => {
this.user = this.userInfo
})
},
computed: {
...mapState(useAuthStore, ['userInfo', 'isAuthenticated'])
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/util/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ import { mapState } from 'pinia'
import SetNavigation from './SetNavigation.vue'
import { useAuthStore } from '@/stores/auth'
import { useAppStore } from '@/stores/app'
import StaticConfig from '@/common/staticConfig.js'

export default {
name: 'NavBar',
Expand All @@ -125,8 +126,8 @@ export default {
data() {
return {
drawer: null,
bannerEnvironment: 'DEV', //TODO: replace value with null when we've sorted out loading it from configuration
bannerColor: '#8D28D7' //TODO: replace value with null when we've sorted out loading it from configuration
bannerEnvironment: StaticConfig.BANNER_ENVIRONMENT,
bannerColor: StaticConfig.BANNER_COLOR
}
},
async created() {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const router = createRouter({
router.beforeEach((to, _from, next) => {
// this section is to set page title in vue store
const appStore = useAppStore()
if (to && to.meta) {
if (to && to.meta.pageTitle) {
appStore.setPageTitle(to.meta.pageTitle)
} else {
appStore.setPageTitle('')
Expand Down
1 change: 0 additions & 1 deletion frontend/src/stores/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export const useAppStore = defineStore('app', {
}
},
async getConfig() {
/* TODO: uncomment during integration with backend... */
const response = await ApiService.getConfig();
await this.setConfig(response.data);
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/stores/auth.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineStore } from 'pinia'
import ApiService from '@/common/apiService'
import { Routes } from '@/utils/constants'
import AuthService from '@/common/authService';
import { Routes } from '@/utils/constants'
import { defineStore } from 'pinia'

export const useAuthStore = defineStore('auth', {
namespaced: true,
Expand Down
15 changes: 13 additions & 2 deletions frontend/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,16 @@ export default defineConfig({
changeOrigin: true
}
}
}
})
},

}








)

Loading

0 comments on commit ca70ba8

Please sign in to comment.