Skip to content

Commit e16c88b

Browse files
authored
Merge branch 'main' into patch-1
2 parents 0a13b6a + d84e1ae commit e16c88b

35 files changed

+6528
-5616
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": ["@nuxtjs/eslint-config-typescript"],
33
"rules": {
44
"no-redeclare": "off",
5+
"import/named": "off",
56
"vue/html-self-closing": "off",
67
"vue/multi-word-component-names": "off",
78
"@typescript-eslint/no-unused-vars": "off"

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
- name: Install dependencies
3838
run: pnpm install
3939

40+
- run: pnpm dev:prepare
41+
4042
- name: Build
4143
run: pnpm build
4244

@@ -66,6 +68,8 @@ jobs:
6668
- name: Install dependencies
6769
run: pnpm install
6870

71+
- run: pnpm dev:prepare
72+
6973
- name: Lint
7074
run: pnpm lint
7175

@@ -95,6 +99,8 @@ jobs:
9599
- name: Install dependencies
96100
run: pnpm install
97101

102+
- run: pnpm dev:prepare
103+
98104
- name: Run Tests
99105
run: pnpm test -- --coverage --no-threads
100106

docs/content/1.getting-started/2.gql-functions.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,36 @@ description: 'Gql functions are automatically generated and imported based on yo
77

88
Gql Functions are automatically generated and imported based on the GraphQL operations in the project.
99

10+
## Example
11+
12+
```graphql [example.gql]
13+
query GetUsers {
14+
users {
15+
id
16+
name
17+
}
18+
}
19+
20+
mutation LoginUser($email: String!, $password: String!) {
21+
login(email: $email, password: $password) {
22+
id
23+
name
24+
}
25+
}
26+
```
27+
28+
The GraphQL document above will generate two Gql Functions (`GqlGetUsers` and `GqlLoginUser`) that are automatically imported, and can be utilized as shown below:
29+
30+
```ts
31+
async function loadUsers() {
32+
const result = await GqlGetUsers()
33+
}
34+
35+
async function handleLogin(email: string, password: string) {
36+
const result = await GqlLoginUser(email, password)
37+
}
38+
```
39+
1040
## Understanding
1141

1242
Writing GraphQL operations in SFC components is **not supported**, this decision is at the heart of this module.

docs/content/1.getting-started/3.composables.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,14 @@ export default defineNuxtPlugin(() => {
138138
Change the host of a GraphQL Client at runtime.
139139

140140
```ts
141-
// Change the host of the default client
142-
useGqlHost('<host>')
141+
export default defineNuxtPlugin(() => {
142+
// Change the host of the default client
143+
useGqlHost('<host>')
144+
145+
// Change the host of a specific client
146+
useGqlHost('<host>', '<client>')
143147

144-
// Change the host of a specific client
145-
useGqlHost('<host>', '<client>')
148+
// Add query parameters to the preconfigured host
149+
useGqlHost('?param1=one&param2=two')
150+
})
146151
```

docs/content/1.getting-started/4.configuration.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,19 @@ Pass cookies from the browser to the GraphQL API in SSR mode.
188188
Enabled by default.
189189
::
190190

191+
### `corsOptions`
192+
193+
Specify CORS options to be used for client-side requests.
194+
195+
```ts [Type Signature]
196+
{
197+
corsOptions: {
198+
mode: "cors" | "navigate" | "no-cors" | "same-origin"
199+
credentials: "include" | "omit" | "same-origin"
200+
}
201+
}
202+
```
203+
191204
### `preferGETQueries`
192205

193206
- default: `false`
@@ -240,6 +253,7 @@ Configuration for the token storage.
240253

241254
```ts [Type Signature]
242255
{
256+
name: 'gql:<clientname>'
243257
mode: 'cookie' | 'localStorage'
244258
cookieOptions: {
245259
path: string

docs/content/2.advanced/1.authentication.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ export default defineNuxtConfig({
4545

4646
'graphql-client': {
4747
tokenStorage: {
48-
mode: 'cookie',
48+
name: '__session',
49+
mode: 'cookie', // default
4950
cookieOptions: {
5051
path: '/',
5152
secure: false, // defaults to `process.env.NODE_ENV === 'production'`
52-
httpOnly: true, // Only accessible via HTTP(S)
53+
httpOnly: false, // Only accessible via HTTP(S)
5354
maxAge: 60 * 60 * 24 * 5 // 5 days
5455
}
5556
}

docs/nuxt.config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ export default defineNuxtConfig({
55
preference: 'dark'
66
},
77

8-
routeRules: {
9-
'/': { prerender: true }
10-
},
11-
128
content: {
139
highlight: {
1410
preload: ['graphql']

docs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"devDependencies": {
1313
"@nuxt-themes/docus": "npm:@nuxt-themes/docus-edge@latest",
14-
"nuxt": "npm:nuxt3@latest"
14+
"@nuxtjs/tailwindcss": "^6.1.3",
15+
"nuxt": "latest"
1516
},
1617
"packageManager": "[email protected]"
1718
}

0 commit comments

Comments
 (0)