Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A first look at hasura example
export const promotionsFetchEpic = (
action$: ActionsObservable<PayloadAction>,
state$: StateObservable<StoreState>,
): Observable<PayloadAction> =>
action$.pipe(
filter((action) => action.type === appDataFetchSuccess.toString()),
asyncRequest(
promotionsFetchStart.toString(),
promotionsFetchSuccess.toString(),
promotionsFetchError.toString(),
(action: PayloadAction) => {
const shopOrgin = selectShopOrigin(state$.value);
return hasuraGraphqlRequest(
`
query PromotionsFetch {
promotion(where: {shop_origin: {_eq: "${shopOrgin}"}}) {
promotion_id
promotion_type
countdown_promotion {
countdown_timer_message
countdown_timer_message_font_size
...
}
text_promotion {
custom_message
...
}
promotion_products {
product_id
promotion_id
product {
...
}
}
}
}
`,
{},
selectJwt(state$.value),
);
},
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment