Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions utils/http.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type RequestInit } from "@deco/deco";
import { fetchSafe } from "./fetch.ts";
import { type DecoRequestInit as RequestInit, fetchSafe } from "./fetch.ts";

// Check if DEBUG_HTTP env var is set
const DEBUG_HTTP = Deno.env.get("DEBUG_HTTP") === "true";
Expand Down
15 changes: 14 additions & 1 deletion vtex/utils/intelligentSearch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AppContext } from "../mod.ts";
import { STALE } from "../../utils/fetch.ts";
import type {
PageType,
SelectedFacet,
SimulationBehavior,
Sort,
Expand Down Expand Up @@ -148,7 +149,19 @@ export const pageTypesFromUrl = async (
segments.map((_, index) =>
vcsDeprecated["GET /api/catalog_system/pub/portal/pagetype/:term"]({
term: segments.slice(0, index + 1).join("/"),
}, STALE).then((res) => res.json())
}, STALE).then((res) => res.json()).catch((e) => {
if (e?.status === 400) {
return {
id: null,
name: null,
url: null,
title: null,
metaTagDescription: null,
pageType: "NotFound",
} satisfies PageType;
}
throw e;
})
),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
);
};
Loading