prepend user avatar url by base url if it starts from api base

This commit is contained in:
igoradamenko
2018-02-18 00:37:27 +02:00
parent ff9010f534
commit e08313ea0a
+5
View File
@@ -1,6 +1,7 @@
import { h, Component } from 'preact';
import api from 'common/api';
import { API_BASE, BASE_URL } from 'common/constants';
import { url } from 'common/settings';
import store from 'common/store';
@@ -155,6 +156,10 @@ export default class Comment extends Component {
value: Math.abs(score),
sign: score > 0 ? '+' : (score < 0 ? '' : ''),
},
user: {
...data.user,
picture: data.user.picture.indexOf(API_BASE) === 0 ? `${BASE_URL}${data.user.picture}` : data.user.picture,
},
};
const defaultMods = {