-
Notifications
You must be signed in to change notification settings - Fork 162
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
...slug.js undefined data #72
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trying to fetch data from slug [...slug].js page but showing undefined.
slug page code here
import {GET_PAGES_URI} from '../queries/pages/get-pages';
import {isEmpty} from 'lodash';
import {GET_PAGE} from '../queries/pages/get-page';
import {useRouter} from 'next/router';
import client from '../apollo/client';
import Layout from '../components/layout';
const Page = ( {data} ) => {
console.log('data', data);
}
export default Page;
export async function getStaticProps( {params} ) {
const {data, loading, networkStatus} = await client.query( {
query: GET_PAGE,
variables: {
uri: params?.slug.join( '/' ),
},
} );
}
export async function getStaticPaths() {
const {data} = await client.query( {
query: GET_PAGES_URI
});
}
The text was updated successfully, but these errors were encountered: