Skip to content

Commit

Permalink
Destinations Home Page Carousel fix
Browse files Browse the repository at this point in the history
  • Loading branch information
petrivskyyy authored and gregory-buffard committed Jan 17, 2025
1 parent 5ed16a0 commit c86c9be
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
1 change: 0 additions & 1 deletion admin/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import express from 'express'
import payload from 'payload'

import { getBrochure } from './brochures/getBrochure'
import mountSlug from './payload/utilities/mountSlug'

const app = express()
const PORT = process.env.PAYLOAD_PORT || 3000
Expand Down
12 changes: 9 additions & 3 deletions web/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,19 +395,25 @@ export const fetchSitemap = async () => {
updatedAt
}
}
Yachts(limit: 0) {
Yachts(where: { displayOnWebsite: { not_equals: false } }, limit: 0) {
docs {
slug
updatedAt
}
}
Charters(limit: 0) {
Charters(
where: { displayOnWebsite: { not_equals: false } }
limit: 0
) {
docs {
slug
updatedAt
}
}
NewConstructions(limit: 0) {
NewConstructions(
where: { displayOnWebsite: { not_equals: false } }
limit: 0
) {
docs {
slug
updatedAt
Expand Down
42 changes: 20 additions & 22 deletions web/apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,26 @@ import {
} from "@apollo/experimental-nextjs-app-support";
import { setContext } from "@apollo/client/link/context";

const authLink = setContext(
({ headers }: { headers: { [key: string]: string } }) => {
const API_KEY = process.env.PAYLOAD_API_KEY;
return {
headers: {
...headers,
Authorization: API_KEY && `users API-Key ${API_KEY}`,
},
};
const httpLink = new HttpLink({
uri: `${process.env.NEXT_PUBLIC_ADMIN_BASE_URI}/api/graphql`,
fetchOptions: {
cache: "no-cache",
},
});

const authLink = setContext(
({ headers }: { headers: { [key: string]: string } }) => ({
headers: {
...headers,
Authorization: `users API-Key ${process.env.PAYLOAD_API_KEY}`,
},
}),
);

export const { getClient } = registerApolloClient(() => {
return new ApolloClient({
link: authLink.concat(
new HttpLink({
uri: `${process.env.NEXT_PUBLIC_ADMIN_BASE_URI}/api/graphql`,
fetchOptions: {
cache: "no-cache",
},
}),
),
cache: new InMemoryCache(),
});
});
export const { getClient } = registerApolloClient(
() =>
new ApolloClient({
link: authLink.concat(httpLink),
cache: new InMemoryCache(),
}),
);
2 changes: 1 addition & 1 deletion web/components/index/destinations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useEffect, useState } from "react";
const Card = ({ card }: { card: IDestination }) => {
return (
<Link
href={{ pathname: "/destinations/[id]", params: { id: card.id } }}
href={{ pathname: "/destinations/[slug]", params: { slug: card.slug } }}
className={
" flex flex-col w-max justify-center items-start font-classic font-normal tracking-wider group transition-transform lg:duration-[var(--animate-destination)] ease-in-out lg:translate-x-[var(--translate-destination)] pr-[1.5vw]"
}
Expand Down

0 comments on commit c86c9be

Please sign in to comment.