diff --git a/src/ui/components/ChannelSelect.tsx b/src/ui/components/ChannelSelect.tsx new file mode 100644 index 000000000..5b0f86f22 --- /dev/null +++ b/src/ui/components/ChannelSelect.tsx @@ -0,0 +1,28 @@ +"use client"; + +import { useParams, useRouter } from "next/navigation"; + +export const ChannelSelect = ({ + channels, +}: { + channels: { id: string; name: string; slug: string; currencyCode: string }[]; +}) => { + const router = useRouter(); + const params = useParams<{ channel: string }>(); + + return ( + + ); +}; diff --git a/src/ui/components/Footer.tsx b/src/ui/components/Footer.tsx index f5d9c1b64..5c6ace3f2 100644 --- a/src/ui/components/Footer.tsx +++ b/src/ui/components/Footer.tsx @@ -1,5 +1,6 @@ import { LinkWithChannel } from "../atoms/LinkWithChannel"; -import { MenuGetBySlugDocument } from "@/gql/graphql"; +import { ChannelSelect } from "./ChannelSelect"; +import { ChannelsListDocument, MenuGetBySlugDocument } from "@/gql/graphql"; import { executeGraphQL } from "@/lib/graphql"; export async function Footer({ channel }: { channel: string }) { @@ -7,6 +8,15 @@ export async function Footer({ channel }: { channel: string }) { variables: { slug: "footer", channel }, revalidate: 60 * 60 * 24, }); + const channels = process.env.SALEOR_APP_TOKEN + ? await executeGraphQL(ChannelsListDocument, { + withAuth: false, // disable cookie-based auth for this call + headers: { + // and use app token instead + Authorization: `Bearer ${process.env.SALEOR_APP_TOKEN}`, + }, + }) + : null; const currentYear = new Date().getFullYear(); return ( @@ -61,6 +71,14 @@ export async function Footer({ channel }: { channel: string }) { })} + {channels?.channels && ( +
+ +
+ )} +

Copyright © {currentYear} Your Store, Inc.

Powered by Saleor