Merged in fix/fetch-based-on-locale (pull request #154)
fix: fetch content type uid based on lang
This commit is contained in:
@@ -11,7 +11,7 @@ import type { LangParams } from "@/types/params"
|
|||||||
import type { GetFooterData } from "@/types/requests/footer"
|
import type { GetFooterData } from "@/types/requests/footer"
|
||||||
|
|
||||||
export default async function Footer({ lang }: LangParams) {
|
export default async function Footer({ lang }: LangParams) {
|
||||||
const response = await request<GetFooterData>(
|
const { data } = await request<GetFooterData>(
|
||||||
GetFooter,
|
GetFooter,
|
||||||
{
|
{
|
||||||
locale: lang,
|
locale: lang,
|
||||||
@@ -21,7 +21,11 @@ export default async function Footer({ lang }: LangParams) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const footerData = response.data.all_footer.items[0]
|
if (!data.all_footer.items.length) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const footerData = data.all_footer.items[0]
|
||||||
return (
|
return (
|
||||||
<footer className="global-footer">
|
<footer className="global-footer">
|
||||||
<div className="global-footer__content">
|
<div className="global-footer__content">
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
query GetContentTypeUid($locale: String!, $url: String!) {
|
query GetContentTypeUid($locale: String!, $url: String!) {
|
||||||
all_content_page(where: { url: $url, locale: $locale }) {
|
all_content_page(where: { url: $url }, locale: $locale) {
|
||||||
total
|
total
|
||||||
}
|
}
|
||||||
all_current_blocks_page(where: { url: $url, locale: $locale }) {
|
all_current_blocks_page(where: { url: $url }, locale: $locale) {
|
||||||
total
|
total
|
||||||
}
|
}
|
||||||
all_loyalty_page(where: { url: $url, locale: $locale }) {
|
all_loyalty_page(where: { url: $url }, locale: $locale) {
|
||||||
total
|
total
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user