Skip to content

Commit

Permalink
Fix types of image src, add locale to redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
soniaklimas committed Dec 17, 2024
1 parent ff999a7 commit 2550aa1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions apps/storefront/src/app/[locale]/(main)/search/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { DEFAULT_SORT_BY } from "@/config";
import { redirect } from "@/i18n/routing";
import { paths } from "@/lib/paths";
import { getCurrentRegion } from "@/regions/server";

const passThroughParams = ["sortBy", "limit", "q"] as const;

Expand All @@ -13,6 +14,8 @@ export const handleFiltersFormSubmit = async (
const formClear = formData.has("clear");
const params = new URLSearchParams();

const region = await getCurrentRegion();

formData.forEach((value, key) => {
if (key.startsWith("group")) {
const [k, v] = key.replace("group", "").split("-");
Expand Down Expand Up @@ -45,9 +48,10 @@ export const handleFiltersFormSubmit = async (
}
});

return redirect(
paths.search.asPath({
return redirect({
href: paths.search.asPath({
query: Object.fromEntries(params),
}),
);
locale: region.language.locale,
});
};
2 changes: 1 addition & 1 deletion apps/storefront/src/components/search-product-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { PropsWithChildren } from "react";

import type { SearchProduct } from "@nimara/domain/objects/SearchProduct";

import productPlaceholder from "@/assets/product_placeholder.svg";
import productPlaceholder from "@/assets/product_placeholder.svg?url";
import { Link } from "@/i18n/routing";
import { useLocalizedFormatter } from "@/lib/formatters/use-localized-formatter";
import { paths } from "@/lib/paths";
Expand Down

0 comments on commit 2550aa1

Please sign in to comment.