Check user version before adding notifications (#10628)

This commit is contained in:
Keith Holliday 2018-08-26 15:13:36 -05:00 committed by GitHub
parent d198e23de6
commit 0002148326
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,7 +103,7 @@ div
<style lang='scss'>
@import '~client/assets/scss/colors.scss';
/* @TODO: The modal-open class is not being removed. Let's try this for now */
.modal {
overflow-y: scroll !important;
@ -295,9 +295,14 @@ export default {
// Set up Error interceptors
axios.interceptors.response.use((response) => {
if (this.user && response.data && response.data.notifications) {
this.$set(this.user, 'notifications', response.data.notifications);
}
const responseHasNotifications = response.data && response.data.notifications;
if (!responseHasNotifications) return response;
const responseIsUpdateUser = this.user && this.user._v >= response.data.userV;
if (!responseIsUpdateUser) return response;
this.$set(this.user, 'notifications', response.data.notifications);
return response;
}, (error) => {
if (error.response.status >= 400) {