|
1 | 1 | import { LinkWithChannel } from "../atoms/LinkWithChannel";
|
2 |
| -import { MenuGetBySlugDocument } from "@/gql/graphql"; |
| 2 | +import { ChannelSelect } from "./ChannelSelect"; |
| 3 | +import { ChannelsListDocument, MenuGetBySlugDocument } from "@/gql/graphql"; |
3 | 4 | import { executeGraphQL } from "@/lib/graphql";
|
4 | 5 |
|
5 | 6 | export async function Footer({ channel }: { channel: string }) {
|
6 | 7 | const footerLinks = await executeGraphQL(MenuGetBySlugDocument, {
|
7 | 8 | variables: { slug: "footer", channel },
|
8 | 9 | revalidate: 60 * 60 * 24,
|
9 | 10 | });
|
| 11 | + const channels = process.env.SALEOR_APP_TOKEN |
| 12 | + ? await executeGraphQL(ChannelsListDocument, { |
| 13 | + withAuth: false, // disable cookie-based auth for this call |
| 14 | + headers: { |
| 15 | + // and use app token instead |
| 16 | + Authorization: `Bearer ${process.env.SALEOR_APP_TOKEN}`, |
| 17 | + }, |
| 18 | + }) |
| 19 | + : null; |
10 | 20 | const currentYear = new Date().getFullYear();
|
11 | 21 |
|
12 | 22 | return (
|
@@ -61,6 +71,14 @@ export async function Footer({ channel }: { channel: string }) {
|
61 | 71 | })}
|
62 | 72 | </div>
|
63 | 73 |
|
| 74 | + {channels?.channels && ( |
| 75 | + <div className="mb-4 text-neutral-500"> |
| 76 | + <label> |
| 77 | + <span className="text-sm">Change currency:</span> <ChannelSelect channels={channels.channels} /> |
| 78 | + </label> |
| 79 | + </div> |
| 80 | + )} |
| 81 | + |
64 | 82 | <div className="flex flex-col justify-between border-t border-neutral-200 py-10 sm:flex-row">
|
65 | 83 | <p className="text-sm text-neutral-500">Copyright © {currentYear} Your Store, Inc.</p>
|
66 | 84 | <p className="text-sm text-neutral-500">Powered by Saleor</p>
|
|
0 commit comments