Create a .env file on the root folder with a content like the following.
VITE_GRAPHQL_ENDPOINT="http://localhost:4000/graphql"
- This .env file is not commited, and should only be used for local, development variables.
Install the dependencies
npm i
Run this command to generate all graphql requests
npm run generate
Run the project
npm run dev
<script lang="ts">
import { getContextClient, mutationStore } from '@urql/svelte'
import * as gql from '../graphql/generated'
const auth = mutationStore({
client: getContextClient(),
query: gql.SigninDocument,
variables: {
email: '[email protected]',
password: 'example',
},
})
</script>
<p>{$auth.data}</p>
Create a new file inside src/renderer/src/graphql/operations
and follow the same structure
Run this command to generate the graphql requests
npm run generate