Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Js fix console errs & dynamic env params #12

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading