
* Add createGraphQLClient util to shared package * Update urql version and use createGraphQLClient from shared package * Update urql version and use createGraphQLClient from shared package - data importer * Update urql version and use createGraphQLClient from shared package - cms * Update CRM * Update invoices * Update klaviyo * Update slack * Update products feed * Update search * Remove unused urql next * Update monitoring * Update taxes * Remove multipart since no longer used * Update the lockfile * Removed urql introspection since none of our apps used it * Add changeset
14 lines
571 B
TypeScript
14 lines
571 B
TypeScript
import { ChannelsFetcher } from "./channels-fetcher";
|
|
import { createGraphQLClient } from "@saleor/apps-shared";
|
|
import { router } from "../trpc/trpc-server";
|
|
import { protectedClientProcedure } from "../trpc/protected-client-procedure";
|
|
|
|
export const channelsRouter = router({
|
|
fetch: protectedClientProcedure.query(async ({ ctx }) => {
|
|
const client = createGraphQLClient({ saleorApiUrl: ctx.saleorApiUrl, token: ctx.token });
|
|
|
|
const fetcher = new ChannelsFetcher(client);
|
|
|
|
return await fetcher.fetchChannels().then((channels) => channels ?? []);
|
|
}),
|
|
});
|