Skip to content

Instantly share code, notes, and snippets.

@BartoszBilejczyk
Created August 4, 2020 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BartoszBilejczyk/572626a3bd07b9af2c370c1d2352e19d to your computer and use it in GitHub Desktop.
Save BartoszBilejczyk/572626a3bd07b9af2c370c1d2352e19d to your computer and use it in GitHub Desktop.
<template>
<div id="app">
<ApolloQuery
:query="GET_RESULTS"
:notifyOnNetworkStatusChange="true"
>
<template v-slot="{ result: { data, loading }, query }">
<AppNav @search="handleSearch($event, query)" />
<div class="content">
<div class="container">
<AppHeader @search="handleSearch($event, query)" />
<div class="main">
<Map :results="data && data.search && data.search.business" />
<Results
:results="data && data.search && data.search.business"
:loading="loading"
/>
</div>
</div>
</div>
</template>
</ApolloQuery>
</div>
</template>
<script>
import AppNav from '@/components/AppNav.vue'
import AppHeader from '@/components/AppHeader.vue'
import Map from '@/components/Map.vue'
import Results from '@/components/Results.vue'
import { GET_RESULTS } from './graphql/search.query';
export default {
name: 'App',
components: {
AppNav,
AppHeader,
Map,
Results
},
data() {
return {
GET_RESULTS
}
},
methods: {
handleSearch({ term, category }, query) {
query.refetch({term, category});
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment