diff --git a/apps/frontend/src/pages/index.page.tsx b/apps/frontend/src/pages/index.page.tsx
index 23c8f3f..b9a4b69 100644
--- a/apps/frontend/src/pages/index.page.tsx
+++ b/apps/frontend/src/pages/index.page.tsx
@@ -54,8 +54,7 @@ export default function FrontPage() {
useEffect(() => {
if (!selectedCategory || selectedCategory === 'none') {
resetCategory();
- setValues({ options: [] });
- return;
+ return setValues({ options: [] });
}
loadCategory(selectedCategory);
}, [selectedCategory, resetCategory, loadCategory, setValues]);
@@ -85,20 +84,15 @@ export default function FrontPage() {
const handleSubmit = useMemo(
() =>
- onSubmit(
- (data) => {
- getAdvertisementsWithFilter({
- search: data.search,
- category: data.category !== 'none' ? data.category : undefined,
- property_options: data.options
- ?.map((opt) => opt.value)
- .filter((opt) => opt !== 'none'),
- });
- },
- (errors) => {
- console.log(errors);
- },
- ),
+ onSubmit((data) => {
+ getAdvertisementsWithFilter({
+ search: data.search,
+ category: data.category !== 'none' ? data.category : undefined,
+ property_options: data.options
+ ?.map((opt) => opt.value)
+ .filter((opt) => opt !== 'none'),
+ });
+ }),
[onSubmit, getAdvertisementsWithFilter],
);
@@ -172,20 +166,25 @@ export default function FrontPage() {
.loading(() => 'Loading category properties...')
.unwrap()}
-
- {advertisements
- .map((value) =>
- value.length === 0
- ? 'There are no advertisements yet, be the first to place one!'
- : value.map((ad) => (
-
-
-
- )),
- )
- .catch((e) => e.message)
- .unwrap()}
-
+ {advertisements
+ .map((value) => {
+ if (value.length === 0) {
+ return 'There are no advertisements yet, be the first to place one!';
+ }
+
+ return (
+
+ {value.map((ad) => (
+
+
+
+ ))}
+
+ );
+ })
+ .pending(() => 'Loading advertisements...')
+ .catch((e) => e.message)
+ .unwrap()}
);
}