File tree Expand file tree Collapse file tree 4 files changed +14
-23
lines changed
Expand file tree Collapse file tree 4 files changed +14
-23
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import type {
1616 PageType ,
1717 Product as VTEXProduct ,
1818} from "../../utils/types.ts" ;
19- import { LegacyProduct } from "../../utils/types.ts" ;
2019import PDPDefaultPath from "../paths/PDPDefaultPath.ts" ;
2120
2221export interface Props {
@@ -76,11 +75,9 @@ const loader = async (
7675 const locale = segment ?. payload ?. cultureInfo ??
7776 ctx . defaultSegment ?. cultureInfo ?? "pt-BR" ;
7877
79- const pageTypePromise = vcsDeprecated
80- [ "GET /api/catalog_system/pub/portal/pagetype/:term" ] (
81- { term : `${ lowercaseSlug } /p` } ,
82- STALE ,
83- ) . then ( ( res ) => res . json ( ) ) ;
78+ const pageTypePromise = ctx . invoke ( "vtex/loaders/legacy/pageType.ts" , {
79+ term : `${ lowercaseSlug } /p` ,
80+ } ) ;
8481
8582 const url = new URL ( baseUrl ) ;
8683 const skuId = url . searchParams . get ( "skuId" ) || url . searchParams . get ( "idsku" ) ;
Original file line number Diff line number Diff line change @@ -59,10 +59,9 @@ async function loader(
5959 }
6060
6161 if ( slug ) {
62- const pageType = await vcsDeprecated
63- [ "GET /api/catalog_system/pub/portal/pagetype/:term" ] ( {
64- term : `${ slug } /p` ,
65- } , STALE ) . then ( ( res ) => res . json ( ) ) ;
62+ const pageType = await ctx . invoke ( "vtex/loaders/legacy/pageType.ts" , {
63+ term : `${ slug } /p` ,
64+ } ) ;
6665
6766 // Page type doesn't exists or this is not product page
6867 if ( pageType ?. pageType === "Product" ) {
Original file line number Diff line number Diff line change 11import { setCookie } from "std/http/mod.ts" ;
22import { AppContext } from "../mod.ts" ;
3- import { STALE } from "../../utils/fetch.ts" ;
43import type {
54 SelectedFacet ,
65 SimulationBehavior ,
@@ -161,13 +160,11 @@ export const pageTypesFromUrl = async (
161160 ctx : AppContext ,
162161) => {
163162 const segments = segmentsFromSearchParams ( url ) ;
164- const { vcsDeprecated } = ctx ;
165163
166164 return await Promise . all (
167- segments . map ( ( _ , index ) =>
168- vcsDeprecated [ "GET /api/catalog_system/pub/portal/pagetype/:term" ] ( {
169- term : segments . slice ( 0 , index + 1 ) . join ( "/" ) ,
170- } , STALE ) . then ( ( res ) => res . json ( ) )
171- ) ,
165+ segments . map ( ( _ , index ) => {
166+ const term = segments . slice ( 0 , index + 1 ) . join ( "/" ) ;
167+ return ctx . invoke ( "vtex/loaders/legacy/pageType.ts" , { term } ) ;
168+ } ) ,
172169 ) ;
173170} ;
Original file line number Diff line number Diff line change @@ -42,14 +42,12 @@ export const pageTypesFromPathname = async (
4242 ctx : AppContext ,
4343) => {
4444 const segments = segmentsFromTerm ( term ) ;
45- const { vcsDeprecated } = ctx ;
4645
4746 return await Promise . all (
48- segments . map ( ( _ , index ) =>
49- vcsDeprecated [ "GET /api/catalog_system/pub/portal/pagetype/:term" ] ( {
50- term : segments . slice ( 0 , index + 1 ) . join ( "/" ) ,
51- } , STALE ) . then ( ( res ) => res . json ( ) )
52- ) ,
47+ segments . map ( ( _ , index ) => {
48+ const termPath = segments . slice ( 0 , index + 1 ) . join ( "/" ) ;
49+ return ctx . invoke ( "vtex/loaders/legacy/pageType.ts" , { term : termPath } ) ;
50+ } ) ,
5351 ) ;
5452} ;
5553
You can’t perform that action at this time.
0 commit comments