feat(poc): cahnge runtime for test

This commit is contained in:
Björn Meyer 2023-07-14 13:04:52 +02:00
parent 09ecbe89e3
commit 179b92d5d8
10 changed files with 23 additions and 27 deletions

View File

@ -4,15 +4,11 @@ import Prose from 'components/prose';
import { getPage } from 'lib/shopware';
import { notFound } from 'next/navigation';
export const runtime = 'edge';
export const runtime = 'nodejs';
export const revalidate = 43200; // 12 hours in seconds
export async function generateMetadata({
params
}: {
params: { cms: string };
}): Promise<Metadata> {
export async function generateMetadata({ params }: { params: { cms: string } }): Promise<Metadata> {
const page = await getPage(params.cms);
if (!page) return notFound();

View File

@ -1,7 +1,7 @@
import OpengraphImage from 'components/opengraph-image';
import { getPage } from 'lib/shopware';
export const runtime = 'edge';
export const runtime = 'nodejs';
export default async function Image({ params }: { params: { page: string } }) {
const page = await getPage(params.page);

View File

@ -3,7 +3,7 @@ import { revalidateTag } from 'next/cache';
import { headers } from 'next/headers';
import { NextRequest, NextResponse } from 'next/server';
export const runtime = 'edge';
export const runtime = 'nodejs';
// We always need to respond with a 200 status code to Shopify,
// otherwise it will continue to retry the request.

View File

@ -1,6 +1,6 @@
import OpengraphImage from 'components/opengraph-image';
export const runtime = 'edge';
export const runtime = 'nodejs';
export default async function Image() {
return await OpengraphImage();

View File

@ -3,7 +3,7 @@ import { ThreeItemGrid } from 'components/grid/three-items';
import Footer from 'components/layout/footer';
import { Suspense } from 'react';
export const runtime = 'edge';
export const runtime = 'nodejs';
export const metadata = {
description: 'High-performance ecommerce store built with Next.js, Vercel, and Shopware.',

View File

@ -13,7 +13,7 @@ import { HIDDEN_PRODUCT_TAG } from 'lib/constants';
import { getProduct, getProductRecommendations } from 'lib/shopware';
import { Image } from 'lib/shopware/types';
export const runtime = 'edge';
export const runtime = 'nodejs';
export async function generateMetadata({
params

View File

@ -10,7 +10,7 @@ import Pagination from 'components/collection/pagination';
import { getCollection, getCollectionProducts } from 'lib/shopware';
import { defaultSort, sorting } from 'lib/constants';
export const runtime = 'edge';
export const runtime = 'nodejs';
export async function generateMetadata({
params

View File

@ -1,7 +1,7 @@
import OpengraphImage from 'components/opengraph-image';
import { getCollection } from 'lib/shopware';
export const runtime = 'edge';
export const runtime = 'nodejs';
export default async function Image({ params }: { params: { collection: string } }) {
const collection = await getCollection(params.collection);

View File

@ -4,7 +4,7 @@ import FilterList from 'components/layout/search/filter';
import { defaultSort, sorting } from 'lib/constants';
import { getSearchCollectionProducts } from 'lib/shopware';
export const runtime = 'edge';
export const runtime = 'nodejs';
export const metadata = {
title: 'Search',
@ -23,8 +23,9 @@ export default async function SearchPage({
const resultsText = products.length > 1 ? 'results' : 'result';
return (
<>{searchValue && products.length === 0 ? (
<div className='mx-auto flex max-w-7xl flex-col bg-white py-6 text-black dark:bg-black dark:text-white md:flex-row'>
<>
{searchValue && products.length === 0 ? (
<div className="mx-auto flex max-w-7xl flex-col bg-white py-6 text-black dark:bg-black dark:text-white md:flex-row">
<p>
{'There are no products that match '}
<span className="font-bold">&quot;{searchValue}&quot;</span>
@ -32,7 +33,7 @@ export default async function SearchPage({
</div>
) : null}
{products.length > 0 ? (
<div className='mx-auto flex max-w-7xl flex-col bg-white py-6 text-black dark:bg-black dark:text-white md:flex-row'>
<div className="mx-auto flex max-w-7xl flex-col bg-white py-6 text-black dark:bg-black dark:text-white md:flex-row">
<div className="order-first flex-none md:w-1/6">
{searchValue ? (
<p>
@ -40,7 +41,7 @@ export default async function SearchPage({
<span className="font-bold">&quot;{searchValue}&quot;</span>
</p>
) : null}
<p className='pt-4'>Good place to add other suggest search terms ;)</p>
<p className="pt-4">Good place to add other suggest search terms ;)</p>
</div>
<Grid className="grid-cols-2 lg:grid-cols-3">
<ProductGridItems products={products} />

View File

@ -105,7 +105,6 @@ export async function requestSeoUrl(
page: number = 1,
limit: number = 1
): Promise<SeoURLResultSW> {
const fixedHandle = handle.replace('%2F', '/');
return await apiInstance.invoke('readSeoUrl post /seo-url', {
page: page,
limit: limit,
@ -118,12 +117,12 @@ export async function requestSeoUrl(
{
type: 'equals',
field: 'seoPathInfo',
value: fixedHandle + '/'
value: handle + '/'
},
{
type: 'equals',
field: 'seoPathInfo',
value: fixedHandle
value: handle
}
]
}