From 64d153a245d5b96202c576eaf5d50891ef447247 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 24 Feb 2021 15:23:15 +0100 Subject: [PATCH 1/4] add axios for gdd balance --- frontend/src/store/store.js | 37 ++++++++++++++++++++++------ frontend/src/views/KontoOverview.vue | 5 ++++ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index b97bf47a1..d330e2e2b 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -12,11 +12,12 @@ export const store = new Vuex.Store({ is_admin: false, active: false, modals: false, + url: "", user : { name:"", - email:"" - }, - dataLogout: {"session_id": -127182} + email:"", + sessionID: 0 + } }, mutations: { isActive(state) { @@ -31,14 +32,16 @@ export const store = new Vuex.Store({ //console.log("Im Store LOGIN() axios then.statusText ", ldata.statusText); if (ldata.statusText === "OK") { - console.log("STORE login() ldatasession_id", ldata.data.session_id) + //console.log("STORE login() ldatasession_id", ldata.data.session_id) state.is_auth = true state.active = true + state.user.sessionID = ldata.data.session_id + state.user.email = logindata.email $cookies.set('gdd_is_auth','true'); $cookies.set('gdd_session_id', ldata.data.session_id); $cookies.set('gdd_email',logindata.email); - state.user.email = logindata.email - + console.log("cookie ? GRADIDO_LOGIN", $cookies.get('GRADIDO_LOGIN')) + //console.log("STORE login() to " + state.is_auth) router.push('/KontoOverview') @@ -71,7 +74,7 @@ export const store = new Vuex.Store({ }); }, logout(state){ - axios.post("http://localhost/login_api/logout", this.dataLogout).then((ldata) => { + axios.post("http://localhost/login_api/logout", {"session_id": state.user.sessionID}).then((ldata) => { //console.log("Im Store logout() axios then ", ldata); // this.ldata = ldata.data; @@ -79,6 +82,8 @@ export const store = new Vuex.Store({ state.is_auth = false state.is_admin = false state.active = false + state.user.sessionID = '' + state.user.email = '' $cookies.set('gdd_is_auth','false'); $cookies.remove('gdd_email'); $cookies.remove('gdd_session_id'); @@ -87,6 +92,24 @@ export const store = new Vuex.Store({ console.log(error); }); + }, + accountBalance0(state) { + console.log("accountBalance0 => START") + axios.get("http://localhost/state-balances/ajaxGetBalance/739420303").then((req) => { + console.log("accountBalance => ", req) + }, (error) => { + console.log(error); + }); + }, + accountBalance1(state) { + console.log("accountBalance1 => START") + state.url = "http://localhost/state-balances/ajaxGetBalance/"+ state.user.sessionID + console.log(state.url) + axios.get(state.url).then((req) => { + console.log("accountBalance => ", req) + }, (error) => { + console.log(error); + }); } } }) \ No newline at end of file diff --git a/frontend/src/views/KontoOverview.vue b/frontend/src/views/KontoOverview.vue index b568bf8f0..ce5ef6985 100644 --- a/frontend/src/views/KontoOverview.vue +++ b/frontend/src/views/KontoOverview.vue @@ -30,6 +30,8 @@ +
this.$store.commit('accountBalance0')
+
this.$store.commit('accountBalance1')

User Data

/public/json-example/userdata.json @@ -80,6 +82,9 @@ GddAddWork, GddWorkTable, axios + }, + created() { + }, methods: { UserData() { From fb0a8500571f8786e16d696f6bd72b7078198910 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 25 Feb 2021 15:15:39 +0100 Subject: [PATCH 2/4] loginAPI.js change mathods to actions --- frontend/src/mixins/loginAPI.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/mixins/loginAPI.js b/frontend/src/mixins/loginAPI.js index 69c5e1441..d102f381d 100644 --- a/frontend/src/mixins/loginAPI.js +++ b/frontend/src/mixins/loginAPI.js @@ -3,7 +3,7 @@ const LOGIN_API_URL = 'http://localhost/login_api/' // define a mixin object const loginAPI = { - mutations: { + actions: { login: async () => { return axios.post(LOGIN_API_URL + 'unsecureLogin', data); }, From da1cb4e7b6e77745a7d63e6b096952669b6103be Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 25 Feb 2021 15:22:47 +0100 Subject: [PATCH 3/4] merge master --- frontend/src/store/store.js | 14 ++++++++------ frontend/src/views/KontoOverview.vue | 14 ++++++++++---- frontend/src/views/KontoOverview/GddStatus.vue | 13 +++++++++---- login_server | 2 +- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index d330e2e2b..82a25c42c 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -16,7 +16,8 @@ export const store = new Vuex.Store({ user : { name:"", email:"", - sessionID: 0 + sessionID: 0, + balance: 0 } }, mutations: { @@ -30,7 +31,7 @@ export const store = new Vuex.Store({ //console.log("logon TEST =>", logindata ) axios.post("http://localhost/login_api/unsecureLogin", logindata).then((ldata) => { - //console.log("Im Store LOGIN() axios then.statusText ", ldata.statusText); + console.log("Im Store LOGIN() axios then.statusText ", ldata); if (ldata.statusText === "OK") { //console.log("STORE login() ldatasession_id", ldata.data.session_id) state.is_auth = true @@ -41,7 +42,7 @@ export const store = new Vuex.Store({ $cookies.set('gdd_session_id', ldata.data.session_id); $cookies.set('gdd_email',logindata.email); console.log("cookie ? GRADIDO_LOGIN", $cookies.get('GRADIDO_LOGIN')) - + //this.$store.commit('accountBalance') //console.log("STORE login() to " + state.is_auth) router.push('/KontoOverview') @@ -101,12 +102,13 @@ export const store = new Vuex.Store({ console.log(error); }); }, - accountBalance1(state) { - console.log("accountBalance1 => START") + accountBalance(state) { + console.log(" => START") state.url = "http://localhost/state-balances/ajaxGetBalance/"+ state.user.sessionID console.log(state.url) axios.get(state.url).then((req) => { - console.log("accountBalance => ", req) + console.log("accountBalance => ", req.data.balance) + state.user.balance = req.data.balance }, (error) => { console.log(error); }); diff --git a/frontend/src/views/KontoOverview.vue b/frontend/src/views/KontoOverview.vue index ce5ef6985..8ad94fe3a 100644 --- a/frontend/src/views/KontoOverview.vue +++ b/frontend/src/views/KontoOverview.vue @@ -31,12 +31,18 @@
this.$store.commit('accountBalance0')
-
this.$store.commit('accountBalance1')
+
this.$store.commit('accountBalance')

-

User Data

- /public/json-example/userdata.json +

User Balanace

+ this.$store.state.user.balance

- {{userdata}} + {{this.$store.state.user}} +

+
+

User Balanace

+ this.$store.state.user.balance +

+ {{this.$store.state.user.balance}}


diff --git a/frontend/src/views/KontoOverview/GddStatus.vue b/frontend/src/views/KontoOverview/GddStatus.vue index 1b0985665..87825d232 100644 --- a/frontend/src/views/KontoOverview/GddStatus.vue +++ b/frontend/src/views/KontoOverview/GddStatus.vue @@ -4,13 +4,12 @@ - + {{ balance_gdd }} GDD @@ -34,5 +33,11 @@ \ No newline at end of file diff --git a/login_server b/login_server index 2a033c34e..9b9115290 160000 --- a/login_server +++ b/login_server @@ -1 +1 @@ -Subproject commit 2a033c34e4657e84a4387ecfda1cd6102032e95e +Subproject commit 9b9115290c8d2ead756d64b70ae63a6571aa4693 From ceb4dda6fa24694c436bcc151d66a2291145869f Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 26 Feb 2021 11:53:19 +0100 Subject: [PATCH 4/4] style step I --- frontend/src/App.vue | 2 +- frontend/src/routes/routes.js | 23 ++++++------ frontend/src/store/store.js | 29 ++++++++++++---- frontend/src/views/KontoOverview.vue | 3 +- frontend/src/views/Pages/Login.vue | 50 ++++++++++++++++----------- frontend/src/views/Pages/Register.vue | 48 ++++++++++++++++++------- 6 files changed, 103 insertions(+), 52 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index b4c26ef8e..a7658a130 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -22,7 +22,7 @@ export default { this.$router.push('/KontoOverview') // } }else { - this.$router.push("/Landing") + this.$router.push("/Login") } //var user = { id:1, name:'Journal',session:'25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX' }; diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index c571acc30..1ce4875a1 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -11,17 +11,21 @@ const routes = [ redirect: 'landing', component: AuthLayoutGDD, children: [ - { - path: '/Landing', - name: 'Landing', - component: () => import(/* webpackChunkName: "demo" */ '../views/Landing.vue') - }, { path: '/login', name: 'login', component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/Login.vue') }, - + { + path: '/Landing', + name: 'Landing', + component: () => import(/* webpackChunkName: "demo" */ '../views/Landing.vue') + }, + { + path: '/register', + name: 'register', + component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/Register.vue') + }, ] }, { @@ -41,12 +45,7 @@ const routes = [ path: '/profile', name: 'profile', component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/UserProfile.vue') - }, - { - path: '/register', - name: 'register', - component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/Register.vue') - }, + } ] }, , diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 82a25c42c..902004594 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -18,6 +18,14 @@ export const store = new Vuex.Store({ email:"", sessionID: 0, balance: 0 + }, + ajaxCreateData: { + session_id : '', + email: "max.musterman@gmail.de", + amount: 10000000, + target_date:"2021-02-19T13:25:36+00:00", + memo:"AGE", + auto_sign: true } }, mutations: { @@ -68,7 +76,7 @@ export const store = new Vuex.Store({ console.log("Im Store creatUser() axios then ", ldata); // this.ldata = ldata.data; - return true + router.push('/Login') }, (error) => { console.log(error); @@ -88,16 +96,25 @@ export const store = new Vuex.Store({ $cookies.set('gdd_is_auth','false'); $cookies.remove('gdd_email'); $cookies.remove('gdd_session_id'); - router.push('/Landing') + router.push('/Login') }, (error) => { console.log(error); }); }, - accountBalance0(state) { - console.log("accountBalance0 => START") - axios.get("http://localhost/state-balances/ajaxGetBalance/739420303").then((req) => { - console.log("accountBalance => ", req) + ajaxCreate(state){ + state.ajaxCreateData.session_id = state.user.sessionID + console.log(" state.ajaxCreateData => ", state.ajaxCreateData) + axios.post(" http://localhost/transaction-creations/ajaxCreate/", state.ajaxCreateData).then((req) => { + console.log("ajaxCreate => ", req) + }, (error) => { + console.log(error); + }); + }, + ajaxListTransactions(state) { + console.log("ajaxListTransactions => START") + axios.get("http://localhost/state-balances/ajaxListTransactions/"+ state.user.sessionID).then((req) => { + console.log("ajaxListTransactions => ", req) }, (error) => { console.log(error); }); diff --git a/frontend/src/views/KontoOverview.vue b/frontend/src/views/KontoOverview.vue index 8ad94fe3a..6b7e2ded9 100644 --- a/frontend/src/views/KontoOverview.vue +++ b/frontend/src/views/KontoOverview.vue @@ -30,7 +30,8 @@ -
this.$store.commit('accountBalance0')
+
this.$store.commit('ajaxCreate')
+
this.$store.commit('ajaxListTransactions')
this.$store.commit('accountBalance')

User Balanace

diff --git a/frontend/src/views/Pages/Login.vue b/frontend/src/views/Pages/Login.vue index b5f19cd2d..b4fac1b27 100755 --- a/frontend/src/views/Pages/Login.vue +++ b/frontend/src/views/Pages/Login.vue @@ -1,13 +1,23 @@