Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vtex): wishlist loader #918

Merged
merged 1 commit into from
Oct 11, 2024
Merged
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
6 changes: 3 additions & 3 deletions shopify/loaders/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ const buildProxyRoutes = (
ctx: AppContext;
},
) => {
const urlToUse = publicUrl ?
new URL(publicUrl.startsWith("http") ? publicUrl : `https://${publicUrl}`) :
new URL(`https://${storeName}.myshopify.com`);
const urlToUse = publicUrl
? new URL(publicUrl.startsWith("http") ? publicUrl : `https://${publicUrl}`)
: new URL(`https://${storeName}.myshopify.com`);

const hostname = urlToUse.hostname;

Expand Down
3 changes: 1 addition & 2 deletions vtex/actions/wishlist/addItem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import wishlistLoader from "../../loaders/wishlist.ts";
import { AppContext } from "../../mod.ts";
import type { WishlistItem } from "../../utils/types.ts";
import { parseCookie } from "../../utils/vtexId.ts";
Expand Down Expand Up @@ -32,7 +31,7 @@ const action = async (
`mutation AddToWishlist($listItem: ListItemInputType!, $shopperId: String!, $name: String!, $public: Boolean) { addToList(listItem: $listItem, shopperId: $shopperId, name: $name, public: $public) @context(provider: "[email protected]") }`,
}, { headers: { cookie } });

return wishlistLoader({ count: Infinity }, req, ctx);
return ctx.invoke.vtex.loaders.wishlist({ allRecords: true });
};

export default action;
Loading