From 740488cdeb0ba99b47c45f773c84a33c3eef3dec Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Mon, 23 May 2022 10:36:15 +0200 Subject: [PATCH] Add example view to load data from wagtail API --- client/src/router/guards.ts | 2 +- client/src/router/index.ts | 7 +++- client/src/views/CircleAnalyseExampleView.vue | 32 +++++++++++++++++++ server/config/urls.py | 4 +-- server/config/{api.py => wagtail_api.py} | 0 server/example.env | 2 ++ 6 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 client/src/views/CircleAnalyseExampleView.vue rename server/config/{api.py => wagtail_api.py} (100%) diff --git a/client/src/router/guards.ts b/client/src/router/guards.ts index 74fb3b52..a4a909d8 100644 --- a/client/src/router/guards.ts +++ b/client/src/router/guards.ts @@ -1,6 +1,6 @@ import type {NavigationGuardWithThis, RouteLocationNormalized} from 'vue-router'; -import {useUserStore} from '@/stores/user' import type {UserState} from '@/stores/user' +import {useUserStore} from '@/stores/user' import type {Store} from 'pinia'; const cookieName = 'loginStatus' diff --git a/client/src/router/index.ts b/client/src/router/index.ts index 15df7fb6..5d5356d7 100644 --- a/client/src/router/index.ts +++ b/client/src/router/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHistory } from 'vue-router' +import {createRouter, createWebHistory} from 'vue-router' import HomeView from '../views/HomeView.vue'; import {redirectToLoginIfRequired, updateLoggedIn} from '@/router/guards'; @@ -12,6 +12,7 @@ const router = createRouter({ name: 'home', component: HomeView, meta: { + // no login required -> so `public === true` public: true } }, @@ -25,6 +26,10 @@ const router = createRouter({ public: true } }, + { + path: '/analyse', + component: () => import('../views/CircleAnalyseExampleView.vue'), + }, { path: '/profile', component: () => import('../views/ProfileView.vue'), diff --git a/client/src/views/CircleAnalyseExampleView.vue b/client/src/views/CircleAnalyseExampleView.vue new file mode 100644 index 00000000..988f0b0f --- /dev/null +++ b/client/src/views/CircleAnalyseExampleView.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/server/config/urls.py b/server/config/urls.py index ed2fa5ad..efb530e4 100644 --- a/server/config/urls.py +++ b/server/config/urls.py @@ -21,7 +21,7 @@ from vbv_lernwelt.core.views import ( permission_denied_view, check_rate_limit, vue_home, ) -from .api import api_router +from .wagtail_api import api_router def raise_example_error(request): @@ -57,7 +57,7 @@ if settings.ALLOW_LOCAL_LOGIN: urlpatterns += [ # API base url path("api/", include("config.api_router")), - path('api/v2/', api_router.urls), + path('wagtailapi/v2/', api_router.urls), # DRF auth token path("auth-token/", obtain_auth_token), diff --git a/server/config/api.py b/server/config/wagtail_api.py similarity index 100% rename from server/config/api.py rename to server/config/wagtail_api.py diff --git a/server/example.env b/server/example.env index 0549d8cd..7e4c6848 100644 --- a/server/example.env +++ b/server/example.env @@ -1,6 +1,8 @@ export VBV_DATABASE_URL='postgres://vbv_lernwelt@localhost:5432/vbv_lernwelt' #export VBV_DJANGO_LOGGING_CONF=VBV_DJANGO_LOGGING_CONF_CONSOLE_COLOR export VBV_DJANGO_DEBUG=True + +# oauth is for the moment not used export OAUTH_CLIENT_ID=iterativ export OAUTH_CLIENT_SECRET=abced-1234 export OAUTH_ACCESS_TOKEN_URL=https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/token