Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoasjunior committed Oct 2, 2020
2 parents 61d1ce8 + c9f7171 commit 9a464da
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 3 deletions.
78 changes: 78 additions & 0 deletions src/components/EventCard/EventCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<template>
<div>
<div class="p15 mt-10" v-for="(item, i) in dataEventResult" :key="i">

<v-card max-width="500" class="ac cp card-style-1">

<img :src='item.img' class="img-size">

<div class="p10 alg-txt-s">
<h4 class="clr-red">{{ item.eventDate }}</h4>
<h1 class="mt-1">{{ item.title }}</h1>
<span class="mt-2 display-b">Criado por <strong>{{ item.user.name }}</strong> </span>
</div>

<v-divider class="mt-2"></v-divider>
<div class="p10 d-flex">

<div class="d-block">
<v-avatar class="cp" color="orange" size="62">
<v-icon v-if="!item.user.avatar" dark>mdi-account-circle</v-icon>
<img v-else :src="item.user.avatar" alt="avatar" />
</v-avatar>
</div>

</div>


</v-card>

</div>

<!-- <h1>conteuno: {{ eventDataId }}</h1> -->
</div>
</template>
<script>
import {
mapActions, mapGetters
} from 'vuex'
export default {
data:() => ({
url:process.env.VUE_APP_BASE_URL,
dataEventResult:[]
}),
computed:{
...mapGetters({
eventDataId: 'EventVuex/eventDataId'
})
},
methods:{
...mapActions({
getEventById: 'EventVuex/getEventById'
}),
async getEventComents(){
let resultRequest = await this.getEventById(3)
// console.log("jusadiosaihdsahiudsaihduiah")
// console.log(resultRequest)
this.dataEventResult.push(resultRequest)
}
},
created(){
this.getEventComents()
}
}
</script>
<style>
.card-coment{
display: block;
border-top: 1px solid rgba(78, 78, 78, 0.644) !important
}
</style>
2 changes: 1 addition & 1 deletion src/components/cpmCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<v-app-bar color="white" class="d-flex align-center" dense>

<v-avatar size="36" color="orange">
<v-icon v-if="!card.user.avatar" dark>mdi-account-circle</v-icon>
<v-icon v-if="!card.user.avatar" dark>mdi-account-circle</v-icon>
<img v-else :src="card.user.avatar" alt="avatar">
</v-avatar>

Expand Down
5 changes: 5 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ const routes = [
path: '/Profile',
name: 'Profile',
component: () => import('../views/private/Profile.vue')
},
{
path: '/Coment/1',
name: 'Coment',
component: () => import('../views/private/Coment.vue')
}

]
Expand Down
21 changes: 21 additions & 0 deletions src/store/modules/EventVuex.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@

import axios from '../../util/axios'


export default {

namespaced: true,

state: {
eventDataId:''
},

getters: {
eventDataId: state=> state.eventDataId
},

mutations: {
setEventDataId(state, newState){
state.eventDataId = newState
}
},

actions: {
async getEventById(context, newData){

const eventResult = await axios.get(process.env.VUE_APP_BASE_URL + `/event/${newData}`)
try {
context.commit('setEventDataId', eventResult.data)
return eventResult.data
}

catch{
console.log(eventResult)
}

}
}
}
2 changes: 1 addition & 1 deletion src/store/modules/ProfileVuex.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
async getUser(context){
const token = localStorage.getItem('token');
const decodedToken = await axios.post(process.env.VUE_APP_BASE_URL+'/user/authToken', token);

console.log(decodedToken)
const user = await axios.get(process.env.VUE_APP_BASE_URL+`/user/mail/${decodedToken.data}`);

return user.data;
Expand Down
22 changes: 22 additions & 0 deletions src/views/private/Coment.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<div>
<EventCard/>
</div>
</template>
<script>
import EventCard from '../../components/EventCard/EventCard'
export default {
components:{
EventCard
},
data:() => ({
}),
methods:{
},
created(){
}
}
</script>
6 changes: 5 additions & 1 deletion src/views/public/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ export default {
position: "topCenter"
})
localStorage.token = isAuth.data
// localStorage.token = isAuth.data[0]
const token = isAuth.data[0];
localStorage.token = isAuth.data[0];
this.$router.push('/Feed')
}
Expand Down

0 comments on commit 9a464da

Please sign in to comment.