Skip to content

Commit

Permalink
Fix last error
Browse files Browse the repository at this point in the history
  • Loading branch information
haidarafif0809 committed Mar 28, 2018
1 parent 52eb789 commit ad83720
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {
this.$refs.leftSidenav.toggle()
} else {
this.$refs.leftSidenav.toggle()
this.router.push(route)
this.$router.push(route)
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/components/Detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
<div class="md-title">{{ cat.comment }}</div>
</md-card-header-text>
</md-card-header>

<md-card-media>
<img :src="cat.url" :alt="cat.comment">
</md-card-media>

<md-card-content>
{{ cat.detail }}
</md-card-content>
Expand All @@ -23,9 +21,9 @@ export default {
return {
cat: {
asObject: true,
source: this.$db.ref('cats').child(this.id),
source: this.$db.ref('cats').child(this.id)
}
},
}
}
}
</script>
Expand Down
13 changes: 6 additions & 7 deletions src/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
<h1>Home</h1>
<md-card v-for="cat in latestCats" :key="cat['.key']">
<md-card-media>
<img src="cat.url" :alt="cat.comment">
<img :src="cat.url" :alt="cat.comment" style="width: 30px; height: 30px;">
</md-card-media>

<md-card-header>
<div class="md-title">{{ cat.comment }}</div>
</md-card-header>

<md-card-actions>
<router-link to="'/detail/'+cat['.key']">
<router-link :to="{ name: 'Detail', params: {id: cat['.key']}}">
<md-button>Details</md-button>
</router-link>
</md-card-actions>
Expand All @@ -22,13 +21,13 @@
<script>
export default {
firebase () {
{
cats: this.$db.ref('cats');
return {
cats: this.$db.ref('cats')
}
},
computed: {
latestCats: {
this.cats.reverse()
latestCats () {
return this.cats.reverse()
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/components/Post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,28 @@ export default {
detail: ''
},
loading: true,
err: false,
err: false
}
},
methods: {
getCat() {
this.$http.get('http://random.cat/meow')
getCat () {
this.$http.get('https://yesno.wtf/api')
.then((response) => {
this.randomCat.url = response.data.file
this.randomCat.url = response.data.image
setTimeout(() => { this.loading = false }, 1000)
})
.catch((err) => {
console.log(err)
this.err = err
})
},
postCat() {
console.log('postCat ', this.randomCat)
postCat () {
this.$db.ref('cats').push(this.randomCat, () => {
this.$router.push('/');
this.$router.push('/')
})
}
},
mounted: {
mounted () {
this.getCat()
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Vue from 'vue'
import VueFire from 'vuefire'
import axios from 'axios'
import App from './App'
import router from 'router'
import router from './router'
import VueMaterial from 'vue-material'
import 'vue-material/dist/vue-material.css'
import firebase from 'firebase'
Expand Down

0 comments on commit ad83720

Please sign in to comment.