Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
zango-frontend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit d4e8a550
authored
2024-06-05 17:46:21 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
.
1 parent
c310a5de
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
13 deletions
components/detail/Detail.js
components/listing/ListingInner.js
components/listing/ListingItems.js
pages/listing.js
redux/actions/activityAction.js
components/detail/Detail.js
View file @
d4e8a55
...
...
@@ -21,7 +21,7 @@ const Detail = () => {
const
{
faqs
}
=
useSelector
(
state
=>
state
.
faqs
);
useEffect
(()
=>
{
// console.log("router", activityById.data.attributes.category?.data?.attributes.name);
dispatch
(
getActivitiesByFilters
({
category
:
activityById
?.
data
.
attributes
.
category
?.
data
?.
id
}));
dispatch
(
getActivitiesByFilters
({
category
:
activityById
?.
data
.
attributes
.
category
?.
data
?.
id
,
currentPage
:
router
.
query
.
page
}));
},
[
activityById
]);
console
.
log
(
"faqs=>"
,
faqs
);
...
...
components/listing/ListingInner.js
View file @
d4e8a55
...
...
@@ -31,7 +31,6 @@ const ListingInner = ({ allActivitiesData, loading, totalCount }) => {
setGridClass
(
className
);
};
useEffect
(()
=>
{
const
handleResize
=
()
=>
{
// console.log("Window Width:");
...
...
@@ -108,7 +107,8 @@ const ListingInner = ({ allActivitiesData, loading, totalCount }) => {
maxGroupSize
:
filters
.
maxGroupSize
,
ageLowerLimit
:
filters
.
ageLowerLimit
,
sort
:
filters
.
sort
,
priceUpperLimit
:
filters
.
priceUpperLimit
priceUpperLimit
:
filters
.
priceUpperLimit
,
currentPage
:
router
.
query
.
page
})
);
},
[
activityFilters
]);
...
...
components/listing/ListingItems.js
View file @
d4e8a55
...
...
@@ -38,6 +38,7 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) =>
search
:
queryParams
.
toString
()
});
};
console
.
log
(
"page"
,
page
);
return
(
<>
{
allActivitiesData
&&
!
allActivitiesData
.
data
.
length
==
0
?
(
...
...
pages/listing.js
View file @
d4e8a55
import
{
useRouter
}
from
"next/router"
;
import
{
useEffect
}
from
"react"
;
import
{
useDispatch
}
from
"react-redux"
;
import
Layout
from
"../components/layout/Layout"
;
import
Listing
from
"../components/listing/Listing"
;
import
{
getActivitiesByFilters
}
from
"../redux/actions/activityAction"
;
...
...
@@ -6,13 +9,11 @@ import { wrapper } from "../redux/store";
export
default
function
ListingPage
()
{
/** Client side rendering, traditional API call. */
// const dispatch = useDispatch();
// useEffect(() => {
// const fetchData = async () => {
// await dispatch(getProjects({ currentPage: 1, featuredOnHome: true }));
// };
// fetchData();
// });
const
router
=
useRouter
();
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
dispatch
(
getActivitiesByFilters
({
currentPage
:
router
.
query
.
page
}));
},
[
router
]);
return
(
<
Layout
>
...
...
redux/actions/activityAction.js
View file @
d4e8a55
...
...
@@ -391,11 +391,12 @@ export const getActivitiesByFilters =
sort
,
priceLowerLimit
,
priceUpperLimit
,
currentPage
=
1
currentPage
})
=>
async
dispatch
=>
{
let
sortFilter
=
[];
try
{
console
.
log
(
"page num"
,
currentPage
);
dispatch
({
type
:
GET_ACTIVITIES_REQUEST
,
loading
:
true
...
...
@@ -413,8 +414,8 @@ export const getActivitiesByFilters =
}
let
query
=
{
pagination
:
{
pageSize
:
12
,
page
:
currentPage
pageSize
:
12
// page: Number(currentPage)
},
filters
:
{
approved
:
{
$eq
:
"approved"
}
...
...
@@ -438,6 +439,10 @@ export const getActivitiesByFilters =
]
// sort: ["pricePerPerson:asc"]
};
if
(
currentPage
)
{
query
.
pagination
[
"page"
]
=
Number
(
currentPage
);
}
console
.
log
(
"page query"
,
query
);
if
(
category
)
{
query
.
filters
[
"category"
]
=
category
;
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment