mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-27 12:42:28 +02:00
refactor(starter): upgrade to new version of gatsby
This commit is contained in:
29
internal/gatsby/queries/posts-query.ts
Normal file
29
internal/gatsby/queries/posts-query.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { CreatePagesArgs } from "gatsby";
|
||||
|
||||
import * as types from "../types";
|
||||
|
||||
export interface PostsQueryResult {
|
||||
allMarkdownRemark: {
|
||||
edges?: Array<types.Edge>;
|
||||
};
|
||||
}
|
||||
|
||||
const postsQuery = async (graphql: CreatePagesArgs["graphql"]) => {
|
||||
const result = await graphql<PostsQueryResult>(`
|
||||
{
|
||||
allMarkdownRemark(filter: { frontmatter: { draft: { ne: true } } }) {
|
||||
edges {
|
||||
node {
|
||||
fields {
|
||||
slug
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
|
||||
return result?.data?.allMarkdownRemark;
|
||||
};
|
||||
|
||||
export default postsQuery;
|
Reference in New Issue
Block a user