You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-28Lines changed: 14 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,20 +40,6 @@ export default defineConfig({
40
40
});
41
41
```
42
42
43
-
For convenience, you may also wish to register aliases for importing the generated files into your application:
44
-
45
-
```ts
46
-
exportdefaultdefineConfig({
47
-
// ...
48
-
resolve: {
49
-
alias: {
50
-
"@actions/": "./resources/js/actions",
51
-
"@routes/": "./resources/js/routes",
52
-
},
53
-
},
54
-
});
55
-
```
56
-
57
43
## Generating TypeScript Definitions
58
44
59
45
The `wayfinder:generate` command can be used to generate TypeScript definitions for your routes and controller methods:
@@ -82,15 +68,15 @@ You can safely `.gitignore` the `wayfinder`, `actions`, and `routes` directories
82
68
Wayfinder functions return an object that contains the resolved URL and default HTTP method:
83
69
84
70
```ts
85
-
import { show } from"@actions/App/Http/Controllers/PostController";
71
+
import { show } from"@/actions/App/Http/Controllers/PostController";
86
72
87
73
show(1); // { url: "/posts/1", method: "get" }
88
74
```
89
75
90
76
If you just need the URL, or would like to choose a method from the HTTP methods defined on the server, you can invoke additional methods on the Wayfinder generated function:
91
77
92
78
```ts
93
-
import { show } from"@actions/App/Http/Controllers/PostController";
79
+
import { show } from"@/actions/App/Http/Controllers/PostController";
All Wayfinder methods accept an optional, final `options` argument to which you may pass a `query` object. This object can be used to append query parameters onto the resulting URL:
205
191
206
192
```ts
207
-
import { show } from"@actions/App/Http/Controllers/PostController";
193
+
import { show } from"@/actions/App/Http/Controllers/PostController";
0 commit comments