diff --git a/.eslintignore b/.eslintignore index 9f81cf8..9d5fd02 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,4 +4,5 @@ /.quasar /node_modules .eslintrc.cjs +/src /quasar.config.*.temporary.compiled* diff --git a/package-lock.json b/package-lock.json index 7213a78..a04e0b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@quasar/extras": "^1.16.4", "axios": "^1.2.1", - "keycloak-js": "^24.0.2", + "keycloak-js": "^24.0.3", "pinia": "^2.0.11", "quasar": "^2.8.0", "vue": "^3.4.18", @@ -4800,9 +4800,9 @@ } }, "node_modules/keycloak-js": { - "version": "24.0.2", - "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-24.0.2.tgz", - "integrity": "sha512-V2N8cSz3NfON98XHp+DCzvrb1WW35JalL5Zphe/uoVWOxcof7v522Yz9Q2O3BqXqXP3V/H9ml6o24BwwtXUTGA==", + "version": "24.0.3", + "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-24.0.3.tgz", + "integrity": "sha512-4L0zTiQATKZiGQ6WM5qjjUIrN7pntzHDy4JebvgWA+im3oUDQ8UmQhIU0wnhONKrUK8pM4chyE/vDNStBNcR8w==", "dependencies": { "js-sha256": "^0.11.0", "jwt-decode": "^4.0.0" @@ -10918,9 +10918,9 @@ "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==" }, "keycloak-js": { - "version": "24.0.2", - "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-24.0.2.tgz", - "integrity": "sha512-V2N8cSz3NfON98XHp+DCzvrb1WW35JalL5Zphe/uoVWOxcof7v522Yz9Q2O3BqXqXP3V/H9ml6o24BwwtXUTGA==", + "version": "24.0.3", + "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-24.0.3.tgz", + "integrity": "sha512-4L0zTiQATKZiGQ6WM5qjjUIrN7pntzHDy4JebvgWA+im3oUDQ8UmQhIU0wnhONKrUK8pM4chyE/vDNStBNcR8w==", "requires": { "js-sha256": "^0.11.0", "jwt-decode": "^4.0.0" diff --git a/package.json b/package.json index 3149ef1..0a3ca0b 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dependencies": { "@quasar/extras": "^1.16.4", "axios": "^1.2.1", - "keycloak-js": "^24.0.2", + "keycloak-js": "^24.0.3", "pinia": "^2.0.11", "quasar": "^2.8.0", "vue": "^3.4.18", diff --git a/quasar.config.js b/quasar.config.js index 462dcad..312ffc7 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -68,7 +68,7 @@ module.exports = configure(function (/* ctx */) { //Defined in realm_export.json, initialize_keycloak.sh and quasar.config.js PORT_KEYCLOAK:8083, PORT_FRONTEND:8080, - PORT_BACKEND:8181, + PORT_BACKEND:8081, }, // rawDefine: {} // ignorePublicFolder: true, @@ -102,6 +102,7 @@ module.exports = configure(function (/* ctx */) { ] }, + // Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#devServer devServer: { // https: true diff --git a/src/boot/axios.ts b/src/boot/axios.ts index 05a9944..5303aa9 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -14,7 +14,7 @@ declare module '@vue/runtime-core' { // good idea to move this instance creation inside of the // "export default () => {}" function below (which runs individually // for each client) -const api = axios.create({ baseURL: 'https://api.example.com' }); +const api = axios.create({ baseURL: 'http://localhost:'+ process.env.PORT_BACKEND }); export default boot(({ app }) => { // for use inside Vue files (Options API) through this.$axios and this.$api diff --git a/src/components/ProtectedData.vue b/src/components/ProtectedData.vue index 8096206..de4c72d 100644 --- a/src/components/ProtectedData.vue +++ b/src/components/ProtectedData.vue @@ -1,8 +1,9 @@ - diff --git a/src/router/routes.ts b/src/router/routes.ts index 2d34fc1..e174e01 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -6,6 +6,10 @@ const routes: RouteRecordRaw[] = [ component: () => import('layouts/MainLayout.vue'), children: [{ path: '', component: () => import('pages/IndexPage.vue') }], }, + { + path: '/test', + component: () => import('pages/TestPage.vue') + }, // Always leave this as last one, // but you can also remove it diff --git a/src/stores/user-store.ts b/src/stores/user-store.ts new file mode 100644 index 0000000..0b226a7 --- /dev/null +++ b/src/stores/user-store.ts @@ -0,0 +1,26 @@ +import { defineStore } from 'pinia'; +import {api} from 'boot/axios'; +import {ptpUser, responseModel} from 'src/models'; +import Keycloak from 'keycloak-js'; + +export const useUserStore = defineStore('userStore', { + state: () => ({ + user: {"keycloakID":null,"firstName":null,"lastName":null,"username":null}, + userLoaded: false, + }), + getters: { + + }, + actions: { + getPtpUserByKeycloakID(keycloakID : string) { + this.loadPtpUsersByKeycloakID(keycloakID).then((response : responseModel) => { + this.user = response.response; + this.userLoaded = true; + console.log("ich habe das gesetzt: " + JSON.stringify(this.user) + " / " + this.userLoaded); + }); + }, + async loadPtpUsersByKeycloakID(keycloakID : string) : Promise { + return (await api.get("/users/login/"+keycloakID)).data; + }, + }, +});