feat(LRL App): init V0
This commit is contained in:
98
resources/js/routes/storage/index.ts
Normal file
98
resources/js/routes/storage/index.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../wayfinder'
|
||||
/**
|
||||
* @see vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php:98
|
||||
* @route '/storage/{path}'
|
||||
*/
|
||||
export const local = (args: { path: string | number } | [path: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: local.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
local.definition = {
|
||||
methods: ["get","head"],
|
||||
url: '/storage/{path}',
|
||||
} satisfies RouteDefinition<["get","head"]>
|
||||
|
||||
/**
|
||||
* @see vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php:98
|
||||
* @route '/storage/{path}'
|
||||
*/
|
||||
local.url = (args: { path: string | number } | [path: string | number ] | string | number, options?: RouteQueryOptions) => {
|
||||
if (typeof args === 'string' || typeof args === 'number') {
|
||||
args = { path: args }
|
||||
}
|
||||
|
||||
if (Array.isArray(args)) {
|
||||
args = {
|
||||
path: args[0],
|
||||
}
|
||||
}
|
||||
|
||||
args = applyUrlDefaults(args)
|
||||
|
||||
const parsedArgs = {
|
||||
path: args.path,
|
||||
}
|
||||
|
||||
return local.definition.url
|
||||
.replace('{path}', parsedArgs.path.toString())
|
||||
.replace(/\/+$/, '') + queryParams(options)
|
||||
}
|
||||
|
||||
/**
|
||||
* @see vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php:98
|
||||
* @route '/storage/{path}'
|
||||
*/
|
||||
local.get = (args: { path: string | number } | [path: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: local.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php:98
|
||||
* @route '/storage/{path}'
|
||||
*/
|
||||
local.head = (args: { path: string | number } | [path: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
url: local.url(args, options),
|
||||
method: 'head',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php:98
|
||||
* @route '/storage/{path}'
|
||||
*/
|
||||
const localForm = (args: { path: string | number } | [path: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: local.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php:98
|
||||
* @route '/storage/{path}'
|
||||
*/
|
||||
localForm.get = (args: { path: string | number } | [path: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: local.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php:98
|
||||
* @route '/storage/{path}'
|
||||
*/
|
||||
localForm.head = (args: { path: string | number } | [path: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: local.url(args, {
|
||||
[options?.mergeQuery ? 'mergeQuery' : 'query']: {
|
||||
_method: 'HEAD',
|
||||
...(options?.query ?? options?.mergeQuery ?? {}),
|
||||
}
|
||||
}),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
local.form = localForm
|
||||
|
||||
const storage = {
|
||||
local: Object.assign(local, local),
|
||||
}
|
||||
|
||||
export default storage
|
||||
Reference in New Issue
Block a user