removed all notifications code

This commit is contained in:
Jack Goh
2018-08-16 10:23:03 +08:00
parent e03dc2e562
commit 5bc4f5929d
6 changed files with 106 additions and 86 deletions
+36 -36
View File
@@ -6,7 +6,7 @@
</router-link>
<template v-if="user">
<el-dropdown trigger="click" align="right">
<!-- <el-dropdown trigger="click" align="right">
<el-badge :value="bellBadge > 0 ? bellBadge : ''" class="item">
<el-button icon="el-icon-bell" circle @click="refreshNoti()"></el-button>
</el-badge>
@@ -32,7 +32,7 @@
<el-button v-if="pagination.next_page_url != null" id="notification-load-more" v-on:click='fetchPaginateBooking(pagination.next_page_url)'>Load more</el-button>
<div v-else id="notification-load-more"></div>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown> -->
</template>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false">
@@ -98,8 +98,8 @@ export default {
data: () => ({
appName: window.config.appName,
notification:[],
loadingNotification:false,
//notification:[],
//loadingNotification:false,
bellBadge : 0,
unread_message_length:0,
url: '/api/notification/user',
@@ -110,7 +110,7 @@ export default {
}),
mounted(){
if(this.user){
this.getNotification(this.url)
//this.getNotification(this.url)
}
},
methods: {
@@ -130,24 +130,24 @@ export default {
console.log(response.data);
})
},
getNotification(url){
this.notification = [];
this.loadingNotification=true;
axios
.get(url)
.then((response) => {
this.loadingNotification=false;
this.notification = response.data.message.data;
this.bellBadge = response.data.unread_message.length;
this.makePagination(response.data.message);
console.log(response.data);
}).catch((error) => {
console.log(error)
this.$router.push({
name: 'notfound'
})
})
},
// getNotification(url){
// this.notification = [];
// this.loadingNotification=true;
// axios
// .get(url)
// .then((response) => {
// this.loadingNotification=false;
// this.notification = response.data.message.data;
// this.bellBadge = response.data.unread_message.length;
// this.makePagination(response.data.message);
// console.log(response.data);
// }).catch((error) => {
// console.log(error)
// this.$router.push({
// name: 'notfound'
// })
// })
// },
makePagination(data){
let pagination ={
current_page: data.current_page,
@@ -159,7 +159,7 @@ export default {
},
fetchPaginateBooking(url) {
this.url = url;
this.loadingNotification=true;
//this.loadingNotification=true;
if(this.url !== null){
axios
.get(url)
@@ -177,18 +177,18 @@ export default {
})
}
},
readNotification(notification_id){
axios
.post('/api/notification/read-notification/'+notification_id)
.then((response) => {
this.getNotification(this.url);
}).catch((error) => {
console.log(error)
this.$router.push({
name: 'notfound'
})
})
},
// readNotification(notification_id){
// axios
// .post('/api/notification/read-notification/'+notification_id)
// .then((response) => {
// this.getNotification(this.url);
// }).catch((error) => {
// console.log(error)
// this.$router.push({
// name: 'notfound'
// })
// })
// },
navigateTo(nav) {
window.location.href = nav;
}