-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
4 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
import { createClient, groq } from "next-sanity"; | ||
import sanity from "@/sanity/lib/client-config"; | ||
|
||
const feedQuery = groq` | ||
const feedQuery = ` | ||
*[_type == "todo"] { | ||
_id, | ||
... | ||
} | order(_createdAt desc) | ||
`; | ||
|
||
export default async function handler(req, res) { | ||
const client = createClient({ | ||
projectId: "0wtsa0of", | ||
dataset: "production", | ||
apiVersion: "2023-05-20", | ||
}); | ||
const todos = await client.fetch(feedQuery); | ||
res.setHeader("Cache-Control", "no-store"); | ||
const todos = await sanity.fetch(feedQuery); | ||
res.status(200).json(todos); | ||
} |
7bc3a82
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nextjs-todo-app – ./
nextjs-todo-app-vert-phi.vercel.app
nextjs-todo-app-bertfarol.vercel.app
nextjs-todo-app-git-main-bertfarol.vercel.app