mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-08-28 07:51:13 +00:00
Finally figured out SQLAlchemy and started to re-write some of the APIs. The UI will completely handle by JS with Vue. There will be no more templating from flask to minimize the resource usage ;)
This commit is contained in:
@@ -3,6 +3,15 @@ import {cookie} from "../utilities/cookie.js";
|
||||
import Index from "@/views/index.vue"
|
||||
import Signin from "@/views/signin.vue";
|
||||
import ConfigurationList from "@/views/configurationList.vue";
|
||||
import {fetchGet} from "@/utilities/fetch.js";
|
||||
|
||||
const checkAuth = async () => {
|
||||
let result = false
|
||||
await fetchGet("/api/validateAuthentication", {}, (res) => {
|
||||
result = res.status
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
@@ -26,9 +35,9 @@ const router = createRouter({
|
||||
]
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
if (to.meta.requiresAuth){
|
||||
if (cookie.getCookie("authToken")){
|
||||
if (cookie.getCookie("authToken") && await checkAuth()){
|
||||
next()
|
||||
}else{
|
||||
next("/signin")
|
||||
|
0
src/static/app/src/stores/wgdashboardStore.js
Normal file
0
src/static/app/src/stores/wgdashboardStore.js
Normal file
@@ -1,6 +1,6 @@
|
||||
export const fetchGet = async (url, params=undefined, callback=undefined) => {
|
||||
const urlSearchParams = new URLSearchParams(params);
|
||||
await fetch(`${url}?${urlSearchParams.toString()}}`, {
|
||||
await fetch(`${url}?${urlSearchParams.toString()}`, {
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ export default defineConfig({
|
||||
},
|
||||
server:{
|
||||
proxy: {
|
||||
'/api': 'http://178.128.231.4:10086/'
|
||||
'/api': 'http://127.0.0.1:10086/'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user