-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1029
- Loading branch information
Showing
40 changed files
with
211 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
NEXT_PUBLIC_SALEOR_API_URL=https://storefront1.saleor.cloud/graphql/ | ||
# make sure to add it on production for correct canonical URLs | ||
NEXT_PUBLIC_STOREFRONT_URL=http://localhost:3000 | ||
|
||
# Token used for fetching channels | ||
SALEOR_APP_TOKEN= |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { type ReactNode } from "react"; | ||
import { executeGraphQL } from "@/lib/graphql"; | ||
import { ChannelsListDocument } from "@/gql/graphql"; | ||
|
||
export const generateStaticParams = async () => { | ||
// the `channels` query is protected | ||
// you can either hardcode the channels or use an app token to fetch the channel list here | ||
|
||
if (process.env.SALEOR_APP_TOKEN) { | ||
const channels = 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}`, | ||
}, | ||
}); | ||
return ( | ||
channels.channels | ||
?.filter((channel) => channel.isActive) | ||
.map((channel) => ({ channel: channel.slug })) ?? [] | ||
); | ||
} else { | ||
return [{ channel: "default-channel" }]; | ||
} | ||
}; | ||
|
||
export default function ChannelLayout({ children }: { children: ReactNode }) { | ||
return children; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { redirect } from "next/navigation"; | ||
|
||
export default function EmptyPage() { | ||
redirect("/default-channel"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.