diff --git a/frontend/src/components/HelloWorld.vue b/frontend/src/components/HelloWorld.vue deleted file mode 100644 index 91413c9..0000000 --- a/frontend/src/components/HelloWorld.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - - - diff --git a/frontend/src/components/TheWelcome.vue b/frontend/src/components/TheWelcome.vue deleted file mode 100644 index a887d34..0000000 --- a/frontend/src/components/TheWelcome.vue +++ /dev/null @@ -1,179 +0,0 @@ - - - diff --git a/frontend/src/components/WelcomeItem.vue b/frontend/src/components/WelcomeItem.vue deleted file mode 100644 index 7b7537d..0000000 --- a/frontend/src/components/WelcomeItem.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/frontend/src/layout/AppLayout.vue b/frontend/src/layout/AppLayout.vue index c6ab286..af17d60 100644 --- a/frontend/src/layout/AppLayout.vue +++ b/frontend/src/layout/AppLayout.vue @@ -68,7 +68,6 @@ const isOutsideClicked = (event) => { -
diff --git a/frontend/src/layout/AppMenu.vue b/frontend/src/layout/AppMenu.vue index 3a8e448..5714a40 100644 --- a/frontend/src/layout/AppMenu.vue +++ b/frontend/src/layout/AppMenu.vue @@ -9,7 +9,6 @@ const model = ref([ items: [ { label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/home' }, { label: 'Chart', icon: 'pi pi-fw pi-chart-bar', to: '/charts' }] - } ]); diff --git a/frontend/src/main.js b/frontend/src/main.js index 11706cb..d0521fd 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -10,6 +10,8 @@ import Chart from 'primevue/chart'; import Dropdown from 'primevue/dropdown'; import InputText from 'primevue/inputtext'; import Password from 'primevue/password'; +import Ripple from 'primevue/ripple'; +import StyleClass from 'primevue/styleclass'; import '@/assets/styles.scss'; const app = createApp(App); @@ -19,6 +21,9 @@ app.use(router); app.use(PrimeVue, { ripple: true }); +app.directive('ripple', Ripple); +app.directive('styleclass', StyleClass); + app.component('Button', Button); app.component('Chart', Chart); app.component('Dropdown', Dropdown); diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 1b5b7aa..6829a40 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -3,6 +3,7 @@ import AppLayout from '@/layout/AppLayout.vue'; import HomeView from '../views/HomeView.vue'; import Landing from '../views/Landing.vue'; import Login from '../views/Login.vue'; +import Chart from '@/views/menu/Chart.vue'; const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -27,8 +28,8 @@ const router = createRouter({ { path: '/charts', name: 'charts', - component: () => import('@/views/menu/Chart.vue') - }, + component: Chart + }/* , { path: '/about', name: 'about', @@ -37,7 +38,7 @@ const router = createRouter({ // which is lazy-loaded when the route is visited. component: () => import('../views/AboutView.vue') - } + } */ ] } ] diff --git a/frontend/src/utils/Auth.js b/frontend/src/utils/Auth.js new file mode 100644 index 0000000..6cb4483 --- /dev/null +++ b/frontend/src/utils/Auth.js @@ -0,0 +1,55 @@ +import { useRouter } from 'vue-router'; +import axios from 'axios'; + +var auth = { + getTokenHeader() { + const token = localStorage.getItem('token'); + + var config = { + headers: { Authorization: `Bearer ${token}` } + }; + + return config; + }, + checkToken(redirect = true, callback = null) { + const url = new URL(window.location.href); + const api = (url.port == "5173") ? "http://localhost:3001" : "/api"; + + const config = this.getTokenHeader(); + + const router = useRouter(); + axios + .get(api + "/auth", + config + ) + .then((response) => { + if (response.status === 204) { + if (callback !== null) { + callback(false); + } + } + else { + if (callback !== null) { + callback(true); + } + } + }) + .catch((err) => { + if (err || !err) { + if (redirect === true) { + if (callback !== null) { + callback(false); + } + router.replace("/"); + } + else { + if (callback !== null) { + callback(false); + } + } + } + }); + } +} + +export default auth; \ No newline at end of file diff --git a/frontend/src/views/AboutView.vue b/frontend/src/views/AboutView.vue deleted file mode 100644 index 5493c66..0000000 --- a/frontend/src/views/AboutView.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue index f4553b1..ee2c816 100644 --- a/frontend/src/views/HomeView.vue +++ b/frontend/src/views/HomeView.vue @@ -1,9 +1,18 @@ diff --git a/frontend/src/views/Landing.vue b/frontend/src/views/Landing.vue index 8562cc8..539f050 100644 --- a/frontend/src/views/Landing.vue +++ b/frontend/src/views/Landing.vue @@ -1,8 +1,4 @@