const FOOTER_QUERY = `
query FooterMenus {
  quickLinks: menu(id: "quick-links", idType: SLUG) {
    menuItems {
      nodes {
        label
        uri
      }
    }
  }

  services: menu(id: "services-links", idType: SLUG) {
    menuItems {
      nodes {
        label
        uri
      }
    }
  }
}
`;

export async function getFooterData() {
  const res = await fetch(process.env.NEXT_PUBLIC_WP_GRAPHQL_URL!, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ query: FOOTER_QUERY }),
    next: { revalidate: 3600 },
  });

  const json = await res.json();
  return json.data;
}
