Last active
January 20, 2021 04:02
-
-
Save stordahl/ca9e877b1223ca1fc0182a7566c94b04 to your computer and use it in GitHub Desktop.
handy @sanity/client TypeScript module
This file contains hidden or 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
import sanityClient from '@sanity/client'; | |
type Client = { | |
projectId: string, | |
dataset: string, | |
token: string, | |
useCdn: boolean | |
} | |
// create instance of sanityClient | |
// this is how you connect your frontend to your sanity studio | |
const options:Client = { | |
//your project ID | |
projectId: '', | |
//your dataset; defaults to production | |
dataset: 'production', | |
token: '', | |
useCdn: true | |
} | |
const client = sanityClient( options ); | |
export { client } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment