Skip to content

Commit

Permalink
Call commonDictionaries with fetchQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrucs committed Jul 16, 2024
1 parent 1bd6a93 commit 01cfc84
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 24 deletions.
5 changes: 2 additions & 3 deletions frontend/src/pages/event/[touristicEvent].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ export const getServerSideProps: GetServerSideProps = async context => {
}),
});
try {
const commonDictionaries = await getCommonDictionaries(locale);
await queryClient.prefetchQuery({
const commonDictionaries = await queryClient.fetchQuery({
queryKey: ['commonDictionaries', locale],
queryFn: () => commonDictionaries,
queryFn: () => getCommonDictionaries(locale),
});

const details = await getTouristicEventDetails(id, locale, commonDictionaries);
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ export const getServerSideProps: GetServerSideProps = async context => {
const suggestions = adaptSuggestions(homePageConfig.suggestions, locale);

if (suggestions !== null) {
const commonDictionaries = await getCommonDictionaries(locale);
await queryClient.prefetchQuery({
const commonDictionaries = await queryClient.fetchQuery({
queryKey: ['commonDictionaries', locale],
queryFn: () => commonDictionaries,
queryFn: () => getCommonDictionaries(locale),
});

const activitySuggestionIds = suggestions.flatMap(suggestion =>
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/pages/information/[flatPage].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ export const getServerSideProps: GetServerSideProps = async context => {
}),
});

const commonDictionaries = await getCommonDictionaries(locale);
await queryClient.prefetchQuery({
const commonDictionaries = await queryClient.fetchQuery({
queryKey: ['commonDictionaries', locale],
queryFn: () => commonDictionaries,
queryFn: () => getCommonDictionaries(locale),
});

const details = await getFlatPageDetails(id, locale, commonDictionaries);
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/pages/outdoor-course/[outdoorCourse].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ export const getServerSideProps: GetServerSideProps = async context => {
});

try {
const commonDictionaries = await getCommonDictionaries(locale);
await queryClient.prefetchQuery({
const commonDictionaries = await queryClient.fetchQuery({
queryKey: ['commonDictionaries', locale],
queryFn: () => commonDictionaries,
queryFn: () => getCommonDictionaries(locale),
});

const details = await getOutdoorCourseDetails(id, locale, commonDictionaries);
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/pages/outdoor-site/[outdoorSite].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ export const getServerSideProps: GetServerSideProps = async context => {
});

try {
const commonDictionaries = await getCommonDictionaries(locale);
await queryClient.prefetchQuery({
const commonDictionaries = await queryClient.fetchQuery({
queryKey: ['commonDictionaries', locale],
queryFn: () => commonDictionaries,
queryFn: () => getCommonDictionaries(locale),
});

const details = await getOutdoorSiteDetails(id, locale, commonDictionaries);
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/pages/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ export const getServerSideProps: GetServerSideProps = async context => {
endDate: context.query.endDate ?? '',
};

const commonDictionaries = await getCommonDictionaries(locale);
await queryClient.prefetchQuery({
const commonDictionaries = await queryClient.fetchQuery({
queryKey: ['commonDictionaries', locale],
queryFn: () => commonDictionaries,
queryFn: () => getCommonDictionaries(locale),
});

await queryClient.prefetchQuery({
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/pages/service/[touristicContent].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ export const getServerSideProps: GetServerSideProps = async context => {
});

try {
const commonDictionaries = await getCommonDictionaries(locale);
await queryClient.prefetchQuery({
const commonDictionaries = await queryClient.fetchQuery({
queryKey: ['commonDictionaries', locale],
queryFn: () => commonDictionaries,
queryFn: () => getCommonDictionaries(locale),
});

const details = await getTouristicContentDetails(id, locale, commonDictionaries);
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/pages/trek/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ export const getServerSideProps: GetServerSideProps = async context => {
});

try {
const commonDictionaries = await getCommonDictionaries(locale);
await queryClient.prefetchQuery({
const commonDictionaries = await queryClient.fetchQuery({
queryKey: ['commonDictionaries', locale],
queryFn: () => commonDictionaries,
queryFn: () => getCommonDictionaries(locale),
});

const details = await getDetails(id, locale, commonDictionaries);
Expand Down

0 comments on commit 01cfc84

Please sign in to comment.