-
-
Save jermsam/3fcd978fe70530adcfa0ccf4aaff3927 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app | |
.service('stories') | |
.find() | |
.then(({ data }) => | |
data.map(({ title, goal, user }) => { | |
console.log(user); | |
if (user) { | |
const { id, avatar, firstname, lastname } = user; | |
return { | |
id, | |
title: `${firstname} ${lastname}`, | |
image: `${this.processSource(avatar)}`, | |
description: `${title}`, | |
price: `$ ${goal}` | |
}; | |
} | |
// const { title, goal } = story; | |
return { | |
id: null, | |
title: ``, | |
image: ``, | |
description: ``, | |
price: `` | |
}; | |
}) | |
) | |
.then(source => { | |
const { student } = this.state; | |
if (student.length < 1) return this.resetComponent(); | |
const re = new RegExp(_.escapeRegExp(student), 'i'); | |
const isMatch = result => re.test(result && result.title); | |
if (this._isMounted) { | |
this.setState({ | |
isLoading: false, | |
results: _.filter(source, isMatch) | |
}); | |
} | |
return null; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment