Add example view to load data from wagtail API
This commit is contained in:
parent
532212bf03
commit
740488cdeb
|
|
@ -1,6 +1,6 @@
|
||||||
import type {NavigationGuardWithThis, RouteLocationNormalized} from 'vue-router';
|
import type {NavigationGuardWithThis, RouteLocationNormalized} from 'vue-router';
|
||||||
import {useUserStore} from '@/stores/user'
|
|
||||||
import type {UserState} from '@/stores/user'
|
import type {UserState} from '@/stores/user'
|
||||||
|
import {useUserStore} from '@/stores/user'
|
||||||
import type {Store} from 'pinia';
|
import type {Store} from 'pinia';
|
||||||
|
|
||||||
const cookieName = 'loginStatus'
|
const cookieName = 'loginStatus'
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { createRouter, createWebHistory } from 'vue-router'
|
import {createRouter, createWebHistory} from 'vue-router'
|
||||||
import HomeView from '../views/HomeView.vue';
|
import HomeView from '../views/HomeView.vue';
|
||||||
import {redirectToLoginIfRequired, updateLoggedIn} from '@/router/guards';
|
import {redirectToLoginIfRequired, updateLoggedIn} from '@/router/guards';
|
||||||
|
|
||||||
|
|
@ -12,6 +12,7 @@ const router = createRouter({
|
||||||
name: 'home',
|
name: 'home',
|
||||||
component: HomeView,
|
component: HomeView,
|
||||||
meta: {
|
meta: {
|
||||||
|
// no login required -> so `public === true`
|
||||||
public: true
|
public: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -25,6 +26,10 @@ const router = createRouter({
|
||||||
public: true
|
public: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/analyse',
|
||||||
|
component: () => import('../views/CircleAnalyseExampleView.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/profile',
|
path: '/profile',
|
||||||
component: () => import('../views/ProfileView.vue'),
|
component: () => import('../views/ProfileView.vue'),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<script>
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
count: 0,
|
||||||
|
circleData: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
console.log('CircleAnalyseExampleView mounted');
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
url: 'http://localhost:8000/wagtailapi/v2/pages/?type=learnpath.Circle&slug=analyse&fields=title,description,learning_sequences'
|
||||||
|
}).then((response) => {
|
||||||
|
this.circleData = response.data.items[0];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="circle">
|
||||||
|
<h1>{{circleData.title}}</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -21,7 +21,7 @@ from vbv_lernwelt.core.views import (
|
||||||
permission_denied_view,
|
permission_denied_view,
|
||||||
check_rate_limit, vue_home,
|
check_rate_limit, vue_home,
|
||||||
)
|
)
|
||||||
from .api import api_router
|
from .wagtail_api import api_router
|
||||||
|
|
||||||
|
|
||||||
def raise_example_error(request):
|
def raise_example_error(request):
|
||||||
|
|
@ -57,7 +57,7 @@ if settings.ALLOW_LOCAL_LOGIN:
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
# API base url
|
# API base url
|
||||||
path("api/", include("config.api_router")),
|
path("api/", include("config.api_router")),
|
||||||
path('api/v2/', api_router.urls),
|
path('wagtailapi/v2/', api_router.urls),
|
||||||
|
|
||||||
# DRF auth token
|
# DRF auth token
|
||||||
path("auth-token/", obtain_auth_token),
|
path("auth-token/", obtain_auth_token),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
export VBV_DATABASE_URL='postgres://vbv_lernwelt@localhost:5432/vbv_lernwelt'
|
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_LOGGING_CONF=VBV_DJANGO_LOGGING_CONF_CONSOLE_COLOR
|
||||||
export VBV_DJANGO_DEBUG=True
|
export VBV_DJANGO_DEBUG=True
|
||||||
|
|
||||||
|
# oauth is for the moment not used
|
||||||
export OAUTH_CLIENT_ID=iterativ
|
export OAUTH_CLIENT_ID=iterativ
|
||||||
export OAUTH_CLIENT_SECRET=abced-1234
|
export OAUTH_CLIENT_SECRET=abced-1234
|
||||||
export OAUTH_ACCESS_TOKEN_URL=https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/token
|
export OAUTH_ACCESS_TOKEN_URL=https://sso.test.b.lernetz.host/auth/realms/vbv/protocol/openid-connect/token
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue