-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement loader promotion VTEX (#988)
* feat: implement loader promotion VTEX * fix: remove blog and konfidency from PR * fix: konfidency and blog * fix: space * Update vtex/loaders/promotion/getPromotionById.ts Co-authored-by: Luis Sousa <lv-ss@hotmail.com> --------- Co-authored-by: Luis Sousa <lv-ss@hotmail.com>
- Loading branch information
1 parent
c0dc1d9
commit 30d1d4e
Showing
5 changed files
with
1,679 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { AppContext } from "../../mod.ts"; | ||
import type { Document } from "../../utils/types.ts"; | ||
import { parseCookie } from "../../utils/vtexId.ts"; | ||
|
||
interface Props { | ||
/** | ||
* @description Promotion ID. | ||
*/ | ||
idCalculatorConfiguration: string; | ||
} | ||
|
||
export const defaultVisibility = 'private' | ||
|
||
export default async function loader( | ||
props: Props, | ||
req: Request, | ||
ctx: AppContext, | ||
): Promise<Document[]> { | ||
const { vcs } = ctx; | ||
const { idCalculatorConfiguration } = props; | ||
const { cookie } = parseCookie(req.headers, ctx.account); | ||
|
||
const promotionById = await vcs | ||
["GET /api/rnb/pvt/calculatorconfiguration/:idCalculatorConfiguration"]({ | ||
idCalculatorConfiguration, | ||
}, { | ||
headers: { | ||
accept: "application/json", | ||
"content-type": "application/json", | ||
cookie, | ||
}, | ||
}).then((response: Response) => response.json()); | ||
|
||
return promotionById; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.