mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
make sure endpoint names begin with a /
This commit is contained in:
parent
db1497b9c2
commit
f6b95e40f4
1 changed files with 7 additions and 1 deletions
|
@ -370,6 +370,13 @@ pub fn server_macro_impl(
|
|||
};
|
||||
|
||||
// generate path
|
||||
let fn_path_starts_with_slash = fn_path.to_string().starts_with("\"/");
|
||||
let fn_path = if fn_path_starts_with_slash || fn_path.to_string() == "\"\""
|
||||
{
|
||||
quote! { #fn_path }
|
||||
} else {
|
||||
quote! { concat!("/", #fn_path) }
|
||||
};
|
||||
let path = quote! {
|
||||
if #fn_path.is_empty() {
|
||||
#server_fn_path::const_format::concatcp!(
|
||||
|
@ -415,7 +422,6 @@ pub fn server_macro_impl(
|
|||
#from_impl
|
||||
|
||||
impl #server_fn_path::ServerFn for #struct_name {
|
||||
// TODO prefix
|
||||
const PATH: &'static str = #path;
|
||||
|
||||
type Client = #client;
|
||||
|
|
Loading…
Reference in a new issue