Skip to content

Commit

Permalink
create event with loged user id
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedrolopesh committed Sep 18, 2020
1 parent da76b0c commit 266f2a0
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 13 deletions.
25 changes: 20 additions & 5 deletions src/components/cpmEventForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<v-img src="https://cdn.vuetifyjs.com/images/lists/2.jpg"></v-img>
</v-avatar>
</v-badge> -->
<!-- {{ test }} -->


<v-card class="p10 ac" max-width="600">
<v-card class="p10 ac mt-10" max-width="600">
<div>
<div class="card-style-1">

Expand Down Expand Up @@ -163,7 +163,7 @@ import firebase, { storage } from 'firebase';
import uploadImageToFirebase from '../util/firebase'
import {
mapActions
mapActions, mapGetters
} from 'vuex'
export default {
Expand All @@ -172,6 +172,7 @@ export default {
},
data:() => ({
userId: localStorage.getItem('id'),
fileInput:'',
currentFilePath:'',
value:'',
Expand All @@ -198,7 +199,6 @@ export default {
address:'',
eventDate:'',
img:'',
user:5
},
name:'',
Expand Down Expand Up @@ -244,11 +244,26 @@ export default {
this.eventForm.private = false
},
computed: {
...mapGetters({
test: 'test',
})
},
methods: {
...mapActions({
createEvent: 'createEvent'
}),
testVuex(){
let obj = {
nome:'sei la',
record:'21321083218'
}
this.$store.commit('test', obj)
},
save (date) {
this.$refs.menu.save(date)
},
Expand Down Expand Up @@ -339,7 +354,7 @@ export default {
eventDate:this.eventForm.eventDate,
latitude:this.eventForm.latitude,
longitude:this.eventForm.longitude,
user:{user: this.eventForm.user},
user:{id: this.userId},
}
console.log(body)
Expand Down
2 changes: 1 addition & 1 deletion src/components/cpmToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</v-list-item>

<div>
<v-col>
<v-col align="center" class="mt-10">
<v-btn to="/Login" await @click="logOff()" color="red" dark>SAIR</v-btn>
</v-col>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Vue from 'vue'
import Vuex from 'vuex'
import EventVuex from './modules/EventVuex'
import FeedVuex from './modules/FeedVuex'
import RegisterVuex from './modules/RegisterVuex'
import LoginVuex from './modules/LoginVuex'
Expand Down Expand Up @@ -28,6 +29,7 @@ export default new Vuex.Store({
actions: {
},
modules: {
EventVuex,
RegisterVuex,
FeedVuex,
LoginVuex,
Expand Down
17 changes: 17 additions & 0 deletions src/store/modules/EventVuex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

export default {

namespaced: true,

state: {
},

getters: {
},

mutations: {
},

actions: {
}
}
4 changes: 1 addition & 3 deletions src/store/modules/LoginVuex.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ export default {

async authLogin (context, newData) {

console.log(newData)

const autho = await axios.post(process.env.VUE_APP_BASE_URL + '/user/auth', newData)

localStorage.setItem('id', autho.data[1])
return autho

},
Expand Down
5 changes: 3 additions & 2 deletions src/views/private/Event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<div>
<ToolBar/>

<h1 class="alg-txt-c">CRIAR EVENTO</h1>

<!-- <h1 class="alg-txt-c">CRIAR EVENTO</h1> -->
<EventForm/>

<div class="mx-3"></div>
Expand All @@ -14,10 +13,12 @@ import EventForm from '@/components/cpmEventForm'
import ToolBar from '@/components/cpmToolBar'
export default {
components: {
ToolBar,
EventForm,
},
data:() => ({}),
mounted() {},
Expand Down
2 changes: 2 additions & 0 deletions src/views/private/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default {
methods: {
...mapActions({
getEvents: "FeedVuex/getEvents",
getUser: "ProfileVuex/getUser",
updateUser: "ProfileVuex/updateUser",
getMyEvents: "ProfileVuex/getMyEvents",
Expand Down Expand Up @@ -126,6 +127,7 @@ export default {
},
created() {
this.getEvents();
this.loadUser();
this.loadEvents();
},
Expand Down
6 changes: 4 additions & 2 deletions src/views/public/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

<v-container class="d-flex flex-column justify-center align-center">

<v-btn class="button" color="warning" to="/Login" block>Entrar</v-btn>
<div class="mw-80">
<v-btn class="button" color="warning" to="/Login" block>Entrar</v-btn>

<v-btn class="button" color="warning" to="/Register" block>Cadastro</v-btn>
<v-btn class="button" color="warning" to="/Register" block>Cadastro</v-btn>
</div>

</v-container>

Expand Down

0 comments on commit 266f2a0

Please sign in to comment.