Chat avatar fixes (#9103)

* Ensured rejection doesn't hurt performance

* Added debounce and scroll removal

* Added debounce for keydown

* Fixed linting
This commit is contained in:
Keith Holliday
2017-09-29 16:03:43 -05:00
committed by Sabe Jones
parent dc3a02bc2e
commit 7671347d3a
4 changed files with 51 additions and 16 deletions

View File

@@ -138,12 +138,21 @@ export default {
// @TODO split up this file, it's too big
// Set up Error interceptors
axios.interceptors.response.use((response) => {
if (this.user) {
if (this.user && response.data && response.data.notifications) {
this.$set(this.user, 'notifications', response.data.notifications);
}
return response;
}, (error) => {
if (error.response.status >= 400) {
// Don't show errors from getting user details. These users have delete their account,
// but their chat message still exists.
let configExists = Boolean(error.response) && Boolean(error.response.config);
if (configExists && error.response.config.method === 'get' && error.response.config.url.indexOf('/api/v3/members/') !== -1) {
// @TODO: We resolve the promise because we need our caching to cache this user as tried
// Chat paging should help this, but maybe we can also find another solution..
return Promise.resolve(error);
}
this.$store.state.notificationStore.push({
title: 'Habitica',
text: error.response.data.message,