mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-14 20:19:33 +01:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b517ad77b | ||
|
|
77ee994e13 | ||
|
|
67a8a2a3ed | ||
|
|
556b5c8e08 | ||
|
|
85154f12d7 | ||
|
|
26ce46e12b | ||
|
|
c2cfd9a214 | ||
|
|
f736545128 | ||
|
|
59a9eb5f95 | ||
|
|
48fc19076f | ||
|
|
6b83e5d4ea | ||
|
|
0358a258d7 | ||
|
|
8e7f33c9d2 | ||
|
|
b8f4af2df3 | ||
|
|
666751678c | ||
|
|
cab89aaa66 | ||
|
|
4c9850fafc | ||
|
|
07693009f8 | ||
|
|
dceade155c | ||
|
|
4012249f09 | ||
|
|
38eda2c4d6 | ||
|
|
9468af75f4 | ||
|
|
ea24a67a6d | ||
|
|
5e8d04741c | ||
|
|
1032e65a0d | ||
|
|
f261d3feeb | ||
|
|
b1ca09e986 | ||
|
|
b804429fc0 | ||
|
|
7df64296ff |
22
.github/workflows/release.yml
vendored
Normal file
22
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
|
||||
- run: npx changelogithub
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
@@ -29,10 +29,10 @@ export default defineNuxtConfig({
|
||||
modules: ['trpc-nuxt'],
|
||||
trpc: {
|
||||
baseURL: 'http://localhost:3000', // defaults to http://localhost:3000
|
||||
endpoint: '/trpc', // defaults to /api/trpc
|
||||
endpoint: '/trpc', // defaults to /trpc
|
||||
},
|
||||
typescript: {
|
||||
strict: true // set this to true to make input/output types work
|
||||
strict: true // required to make input/output types work
|
||||
}
|
||||
})
|
||||
```
|
||||
@@ -111,7 +111,6 @@ const { data: token } = await useAsyncQuery(['auth.login', { username, password
|
||||
headers.value.Authorization = `Bearer ${token}`
|
||||
|
||||
// All client calls will now include the Authorization header.
|
||||
// For SSR, please follow this link https://github.com/trpc/trpc/discussions/1686
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
22
package.json
22
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "trpc-nuxt",
|
||||
"type": "module",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.3",
|
||||
"packageManager": "pnpm@7.1.1",
|
||||
"license": "MIT",
|
||||
"main": "./dist/module.cjs",
|
||||
@@ -32,27 +32,27 @@
|
||||
"prepare": "nuxi prepare playground"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxt/kit": "^3.0.0-rc.3",
|
||||
"@trpc/client": "^9.23.3",
|
||||
"@trpc/server": "^9.23.2",
|
||||
"@vueuse/core": "^8.5.0",
|
||||
"@vueuse/nuxt": "^8.5.0",
|
||||
"@nuxt/kit": "^3.0.0-rc.4",
|
||||
"@trpc/client": "^9.26.0",
|
||||
"@trpc/server": "^9.26.0",
|
||||
"@vueuse/core": "^8.9.3",
|
||||
"@vueuse/nuxt": "^8.9.3",
|
||||
"dedent": "^0.7.0",
|
||||
"defu": "^6.0.0",
|
||||
"h3": "^0.7.8",
|
||||
"h3": "^0.7.10",
|
||||
"pathe": "^0.3.0",
|
||||
"ufo": "^0.8.4"
|
||||
"ufo": "^0.8.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^0.23.1",
|
||||
"@antfu/ni": "^0.16.2",
|
||||
"@nuxt/module-builder": "latest",
|
||||
"bumpp": "^7.1.1",
|
||||
"@types/dedent": "^0.7.0",
|
||||
"bumpp": "^7.2.0",
|
||||
"eslint": "^8.14.0",
|
||||
"nuxt": "^3.0.0-rc.3",
|
||||
"nuxt": "3.0.0-rc.4",
|
||||
"ohash": "^0.1.0",
|
||||
"pnpm": "^7.1.1",
|
||||
"superjson": "^1.9.1",
|
||||
"trpc-nuxt": "workspace:*",
|
||||
"zod": "^3.16.0"
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@ import * as trpc from '@trpc/server'
|
||||
import type { inferAsyncReturnType } from '@trpc/server'
|
||||
import { z } from 'zod'
|
||||
import type { CompatibilityEvent } from 'h3'
|
||||
import { useCookies } from 'h3'
|
||||
|
||||
const baseURL = 'https://jsonplaceholder.typicode.com'
|
||||
|
||||
@@ -30,6 +29,7 @@ export const router = trpc.router<Context>()
|
||||
.mutation('addTodo', {
|
||||
input: TodoShape,
|
||||
async resolve(req) {
|
||||
console.log(req.input)
|
||||
return await $fetch<Todo>(`${baseURL}/todos`, {
|
||||
method: 'POST',
|
||||
body: req.input,
|
||||
|
||||
2262
pnpm-lock.yaml
generated
2262
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,2 @@
|
||||
packages:
|
||||
- playground/*
|
||||
- playground
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { fileURLToPath } from 'url'
|
||||
import { join, resolve } from 'pathe'
|
||||
import { defu } from 'defu'
|
||||
// @ts-expect-error: No types
|
||||
import dedent from 'dedent'
|
||||
|
||||
import { addAutoImport, addPlugin, addServerHandler, addTemplate, defineNuxtModule } from '@nuxt/kit'
|
||||
@@ -40,6 +39,7 @@ export default defineNuxtModule<ModuleOptions>({
|
||||
{ name: 'useClient', from: join(runtimeDir, 'client') },
|
||||
{ name: 'useAsyncQuery', from: join(runtimeDir, 'client') },
|
||||
{ name: 'useClientHeaders', from: join(runtimeDir, 'client') },
|
||||
{ name: 'getQueryKey', from: join(runtimeDir, 'client') },
|
||||
])
|
||||
|
||||
addServerHandler({
|
||||
|
||||
Reference in New Issue
Block a user