diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 000000000..71af2b808 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,12 @@ +name: on-push +on: push +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build the stack + run: docker-compose up -d + - name: Test + run: docker run gradido-node-test +timeout-minutes: 2 diff --git a/frontend/src/App.vue b/frontend/src/App.vue index bb9330920..b77f88ea9 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -13,11 +13,13 @@ export default { name: 'app', created () { - if ( $cookies.isKey("gdd_session_id") == true ) { - this.$store.state.email = this.$cookies.get('gdd_u') + //console.log("this.$cookies.get('gdd_session_id') ", this.$cookies.get('gdd_session_id') ) + //console.log(" $cookies.isKey('gdd_session_id') == true", this.$cookies.isKey("gdd_session_id") == true ) + if ( this.$cookies.get('gdd_session_id') == this.$store.state.session_id ) { + //this.$store.state.email = this.$cookies.get('gdd_u') this.$router.push('/KontoOverview') }else { - this.$router.push("/Login") + this.$router.push("/Login") } } } diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 15de73163..844b323b6 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -8,23 +8,23 @@ import NotFound from '@/views/NotFoundPage.vue' const routes = [ { path: '/', - redirect: 'landing', + redirect: 'login', component: AuthLayoutGDD, children: [ { path: '/login', name: 'login', - component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/Login.vue') + component: () => import('../views/Pages/Login.vue') }, { path: '/thx', name: 'Thanks', - component: () => import(/* webpackChunkName: "demo" */ '../views/thx.vue') + component: () => import('../views/Pages/thx.vue') }, { path: '/register', name: 'register', - component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/Register.vue') + component: () => import('../views/Pages/Register.vue') }, ] }, @@ -36,7 +36,7 @@ const routes = [ { path: '/KontoOverview', name: 'Kontoübersicht', - component: () => import(/* webpackChunkName: "demo" */ '../views/KontoOverview.vue'), + component: () => import('../views/KontoOverview.vue'), meta: { requiresAuth: true } @@ -44,7 +44,7 @@ const routes = [ { path: '/profile', name: 'profile', - component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/UserProfile.vue') + component: () => import('../views/Pages/UserProfile.vue') } ] }, @@ -57,7 +57,7 @@ const routes = [ { path: '/AdminOverview', name: 'Adminübersicht', - component: () => import(/* webpackChunkName: "demo" */ '../views/AdminOverview.vue'), + component: () => import('../views/AdminOverview.vue'), meta: { requiresAuth: true } diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 1b8c18426..1f1c59223 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -4,6 +4,8 @@ Vue.use(Vuex) import router from '../routes/router.js' import loginAPI from '../apis/loginAPI' import communityAPI from '../apis/communityAPI' +import axios from 'axios' + export const store = new Vuex.Store({ state: { @@ -11,14 +13,15 @@ export const store = new Vuex.Store({ email: null, user : { name:"", - balance: 0 + balance: 0, + balance_gdt: 0 }, ajaxCreateData: { session_id : '', - email: "max.musterman@gmail.de", - amount: 10000000, + email: "", + amount: 0, target_date:"2021-02-19T13:25:36+00:00", - memo:"AGE", + memo:"", auto_sign: true }, transactions: [], @@ -33,26 +36,30 @@ export const store = new Vuex.Store({ // Syncronous mutation of the state mutations: { email: (state, email) => { - console.log('mutation: email') + //console.log('mutation: email') state.email = email }, session_id: (state,session_id) => { - console.log('mutation: session_id') + //console.log('mutation: session_id') state.session_id = session_id }, user_balance: (state,balance) => { - console.log('mutation: user_balance') + //console.log('mutation: user_balance') state.user.balance = balance }, + user_balance_gdt: (state,balance) => { + //console.log('mutation: user_balance_gdt') + state.user.balance_gdt = balance + }, transactions: (state,transactions) => { - console.log('mutation: transactions') + //console.log('mutation: transactions') state.transactions = transactions } }, // Asyncronous actions - used for api calls actions: { login: async ({ dispatch, commit }, data) => { - console.log('action: login') + //console.log('action: login') const result = await loginAPI.login(data.email,data.password) if( result.success ){ commit('session_id', result.result.data.session_id) @@ -94,35 +101,52 @@ export const store = new Vuex.Store({ router.push('/Login') }, ajaxCreate: async ({ dispatch, state }) => { - console.log('action: ajaxCreate') - console.log(state.ajaxCreateData) + //console.log('action: ajaxCreate') + //console.log("dispatch", dispatch) + //console.log("state.ajaxCreateData", state.ajaxCreateData) + /* const result = await communityAPI.create( state.ajaxCreateData.session_id, state.ajaxCreateData.email, state.ajaxCreateData.amount, - state.ajaxCreateData.memo, state.ajaxCreateData.target_date, + state.ajaxCreateData.memo ) + */ + + /* + this.ajaxCreateData.session_id : '', + this.ajaxCreateData.email: "max.musterman@gmail.de", + this.ajaxCreateData.amount: 10000000, + this.ajaxCreateData.target_date:"2021-02-19T13:25:36+00:00", + this.ajaxCreateData.memo:"AGE", + this.ajaxCreateData.auto_sign: true + */ + + + axios.post("http://localhost/transaction-creations/ajaxCreate", state.ajaxCreateData).then((result) => { + console.log("ajaxCreate result", result) + if( result.success ){ // TODO } else { - dispatch('logout') + //dispatch('logout') } + }, (error) => { + console.log(error); + }); }, ajaxListTransactions: async ({commit, dispatch, state}) => { - console.log('action: ajaxListTransactions') - const result = await communityAPI.transactions(state.session_id) - console.log(result) - if(result.success) { - commit('transactions', result.result.data.transactions) - } else { - dispatch('logout') - } + // console.log('action: ajaxListTransactions', state.session_id) + // const result = await communityAPI.transactions(state.session_id) + + + }, accountBalance: async ({ commit, dispatch, state }) => { - console.log('action: accountBalance') + //console.log('action: accountBalance') const result = await communityAPI.balance(state.session_id) - console.log(result) + //console.log(result) if(result.success) { commit('user_balance', result.result.data.balance) } else { diff --git a/frontend/src/views/KontoOverview.vue b/frontend/src/views/KontoOverview.vue index 4cfcddfe7..4ad3e5ada 100644 --- a/frontend/src/views/KontoOverview.vue +++ b/frontend/src/views/KontoOverview.vue @@ -8,21 +8,18 @@ -
-
+
-
-
+
-

@@ -34,35 +31,7 @@
this.$store.dispatch('ajaxListTransactions')
this.$store.dispatch('accountBalance')

-

User Balanace

- this.$store.state.user.balance -

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

-
-

User Balanace

- this.$store.state.user.balance -

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

- -
-

User Transactions List

- this.$store.state.transactions -

- {{this.$store.state.transactions}} -

- - -
-

User Participation List

- /public/json-example/userparticipation.json -

- {{userparticipation}} -

- - -
+ diff --git a/frontend/src/views/KontoOverview/GddSent.vue b/frontend/src/views/KontoOverview/GddSent.vue index 79c4ad32d..a90ceb563 100644 --- a/frontend/src/views/KontoOverview/GddSent.vue +++ b/frontend/src/views/KontoOverview/GddSent.vue @@ -1,79 +1,68 @@ @@ -176,16 +162,17 @@ export default { async onSubmit() { //event.preventDefault() console.log("onSubmit", this.form) - console.log("this.form.img", this.form.img) - console.log("this.form.email", this.form.email) - console.log("this.form.amount", this.form.amount) - console.log("this.form.memo", this.form.memo) + //console.log("this.form.img", this.form.img) + //console.log("this.form.email", this.form.email) + //console.log("this.form.amount", this.form.amount) + //console.log("this.form.memo", this.form.memo) this.$store.state.ajaxCreateData.session_id = this.$cookies.get('gdd_session_id') - this.$store.state.ajaxCreateData.email = this.form.email, - this.$store.state.ajaxCreateData.amount = this.form.amount, - this.$store.state.ajaxCreateData.memo = this.form.memo, - + this.$store.state.ajaxCreateData.email = this.form.email + this.$store.state.ajaxCreateData.amount = this.form.amount + this.$store.state.ajaxCreateData.memo = this.form.memo + this.$store.state.ajaxCreateData.target_date = Date.now() + this.$store.dispatch('ajaxCreate') }, onReset(event) { diff --git a/frontend/src/views/KontoOverview/GddStatus.vue b/frontend/src/views/KontoOverview/GddStatus.vue index 2b09755be..02a17e894 100644 --- a/frontend/src/views/KontoOverview/GddStatus.vue +++ b/frontend/src/views/KontoOverview/GddStatus.vue @@ -6,7 +6,7 @@ type="gradient-red" sub-title="balance_gdd" class="mb-4"> - {{ balance_gdd }} GDD + {{ setComma($store.state.user.balance) }} GDD @@ -15,9 +15,9 @@ - {{ balance_gdt }} GDT + {{ setComma($store.state.user.balance_gdt) }} GDT @@ -33,8 +33,14 @@ export default { data(){ return { balance_gdd: this.$store.state.user.balance, - balance_gdt: "0", + balance_gdt: this.$store.state.user.balance_gdt, } }, + methods: { + setComma(int){ + return int / 10000 + + } + }, }; \ No newline at end of file diff --git a/frontend/src/views/KontoOverview/GddTable.vue b/frontend/src/views/KontoOverview/GddTable.vue index ccc29d67e..55ebc71b0 100644 --- a/frontend/src/views/KontoOverview/GddTable.vue +++ b/frontend/src/views/KontoOverview/GddTable.vue @@ -1,9 +1,9 @@