-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add test of authenticated client
- Loading branch information
Showing
7 changed files
with
89 additions
and
53 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
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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<div class="flex flex-col gap-4"> | ||
<UCard class="p-4"> | ||
<div> | ||
Github Example | ||
</div> | ||
|
||
<div class="flex flex-wrap gap-3 items-center"> | ||
<UInput | ||
v-model="githubToken" | ||
icon="carbon-logo-github" | ||
placeholder="Your Github Token" | ||
/> | ||
|
||
<UButton | ||
:disabled="!githubToken" | ||
@click="setToken" | ||
> | ||
Set Token | ||
</UButton> | ||
|
||
<UButton @click="clearToken"> | ||
Clear Token | ||
</UButton> | ||
</div> | ||
|
||
<div class="mt-4 flex flex-wrap gap-3 items-center"> | ||
<UButton | ||
:disabled="!githubToken" | ||
@click="refresh" | ||
> | ||
Load @me | ||
</UButton> | ||
</div> | ||
</UCard> | ||
|
||
<UCard class="p-4"> | ||
<p v-if="data"> | ||
Logged in as {{ data?.viewer?.login }} | ||
</p> | ||
<p v-else> | ||
Not logged in | ||
</p> | ||
</UCard> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
const githubToken = useState<string | null | undefined>() | ||
const { data, refresh } = await useAsyncGql({ | ||
operation: 'viewer', | ||
client: 'github' | ||
}) | ||
const setToken = () => useGqlToken(githubToken.value, { client: 'github' }) | ||
const clearToken = () => useGqlToken(null, { client: 'github' }) | ||
</script> |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query viewer { | ||
viewer { | ||
login | ||
} | ||
} |
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 |
---|---|---|
|
@@ -77,7 +77,8 @@ | |
}, | ||
"pnpm": { | ||
"overrides": { | ||
"node-fetch": "npm:node-fetch-native@latest" | ||
"node-fetch": "npm:node-fetch-native@latest", | ||
"nuxt-graphql-client": "workspace:*" | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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