]>
git.r.bdr.sh - rbdr/forum/blob - src/stores/forum.js
e7d335e14b0c7b729e3f0fc95a1ee5840821650f
1 import { ApolloError
} from '@apollo/client/core';
2 import { readable
} from 'svelte/store';
3 import { client
} from '$config/apollo';
4 import { GET_FORUM
} from '$data/queries';
8 // The exported data structure
17 export const getForum
= function forum(id
) {
19 return readable(internals
.initialValue
, (set) => {
21 client
.watchQuery({ query: GET_FORUM
, variables: { id
} }).subscribe((result
) => {
24 const error
= new ApolloError({ graphQLErrors: result
.errors
});
34 data: result
.data
.forum
,