danielvdm
07/21/2017, 9:35 AMdanielvdm
07/21/2017, 9:40 AMType
but also needing a model objectdanielvdm
07/21/2017, 9:40 AMexport type ListingType = {
uuid: string,
headline: string,
slug: string,
locationString: string,
photos: [PhotoType],
};
danielvdm
07/21/2017, 9:40 AMdanielvdm
07/21/2017, 9:41 AMdanielvdm
07/21/2017, 9:41 AMget primaryPhoto(): ?PhotoType {
const photo = this.photos.find(p => !!p.isPrimary);
return photo;
}
danielvdm
07/21/2017, 9:41 AMexport class ListingModel {
uuid: string;
headline: string;
slug: string;
locationString: string;
photos: [PhotoType];
get primaryPhoto(): ?PhotoType {
const photo = this.photos.find(p => !!p.isPrimary);
return photo;
}
}
danielvdm
07/21/2017, 9:41 AMdanielvdm
07/21/2017, 9:42 AMdanielvdm
07/21/2017, 9:42 AMtype Props = {
data: {
allListings: Array<ListingType>,
},
};
danielvdm
07/21/2017, 9:43 AMget listings(): Array<ListingModel> {
const { allListings } = this.props.data;
return allListings.map(listing => new ListingModel(listing));
}
danielvdm
07/21/2017, 9:43 AMdanielvdm
07/21/2017, 9:43 AMdanielvdm
07/21/2017, 9:48 AMdanielvdm
07/21/2017, 9:48 AMexport default graphql(listingsQuery, {
props: ({ data: { search } }) => ({
listings: search.map(ListingModel),
}),
})(Home);
giedriusr
07/21/2017, 12:38 PMgiedriusr
07/21/2017, 12:38 PMfreddie-codogo
07/21/2017, 2:09 PMdataIdFromObject
and customResolvers
properties using a graph.cool simple API?giedriusr
07/21/2017, 2:50 PMgiedriusr
07/21/2017, 2:51 PMgiedriusr
07/21/2017, 2:51 PMgiedriusr
07/21/2017, 2:51 PMjoshjoe
07/21/2017, 4:08 PMfrankspin
07/21/2017, 6:23 PMfrankspin
07/21/2017, 7:38 PMfrankspin
07/21/2017, 7:38 PMexport const actions = {
getClients(context) {
const getClientsQuery = apolloClient.query({
query: gql `
{
allClients {
id
name
}
}
`,
refetchQueries: [getClientsQuery]
}).then((result) => {
context.commit('SET_CLIENTS', result.data.allClients);
}).catch((error) => {
console.log('error', error)
})
}
}
frankspin
07/21/2017, 7:38 PMauser
07/21/2017, 9:20 PMauser
07/21/2017, 9:21 PMID!
, can we search by a string value on a recordmikael
07/21/2017, 9:26 PMquery AllLinksSearchQuery($searchText: String!) {
allLinks(filter: {
OR: [{
url_contains: $searchText
}, {
description_contains: $searchText
}]
}) {
id
url
description
createdAt
postedBy {
id
name
}
votes {
id
user {
id
}
}
}
}