Use unique (#2695)

This commit is contained in:
Aya Morisawa
2018-09-12 03:02:14 +09:00
committed by syuilo
parent 046976dffc
commit 0ed197d4d9
2 changed files with 3 additions and 3 deletions

View File

@ -308,7 +308,7 @@ export default Vue.extend({
if (this.text && this.text != '') {
const hashtags = parse(this.text).filter(x => x.type == 'hashtag').map(x => x.hashtag);
const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
localStorage.setItem('hashtags', JSON.stringify(hashtags.concat(history).reduce((a, c) => a.includes(c) ? a : [...a, c], [])));
localStorage.setItem('hashtags', JSON.stringify(unique(hashtags.concat(history))));
}
},