Hello Everyone! New to moralis and Next.js the issue I am running into is I have a dynamic route that pulls up profiles that are stored in my Moralis database, but when I try to get the static paths and static props the query.find function throws an error because it’s trying to access localStorage before the window is rendered… is there a way to query my database with an axios request? Or some way around this that someone knows? The only way I have found to get the query params through Nextjs is through getstaticprops or getserverside props but I have the same issue with both. PLEASE HELP
export const getStaticPaths = async () => {
const ProfileQuery = new Moralis.Query('Profile')
const res = await ProfileQuery.find()
const paths = res.map(profile => {
return {
params: { id: profile.attributes.username }
}
})
return {
paths: paths,
fallback: false
}
}
export async function getStaticProps(context) {
const id = context.params.id
return {
props: { id: id },
}
}