Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using @if with a captured value #43

Open
sc68cal opened this issue Apr 1, 2025 · 2 comments
Open

Error when using @if with a captured value #43

sc68cal opened this issue Apr 1, 2025 · 2 comments

Comments

@sc68cal
Copy link

sc68cal commented Apr 1, 2025

            @if (context.request.?.middleware(.auth).user) |user|
                <a class="btn btn-outline-danger" href="/logout">Logout {{user.email}}</a>
            @else
                <a class="btn btn-outline-light" href="/login">Login</a>
            @end
error: expected statement, found 'else'
} else 
  ^~~~
@sc68cal
Copy link
Author

sc68cal commented Apr 1, 2025

I also tried switching to zig mode but that also did not work

@thienpow
Copy link

thienpow commented Apr 1, 2025

@if (context.request.?.middleware(.auth).user) |user|
Logout {{user.email}}
@else
Login
@EnD

confirmed it's a bug. but if you want to move forward now.. i think you can do a workaround hack like below

@if (context.request.?.middleware(.auth).user) |user|
    <a class="btn btn-outline-danger" href="/logout">Logout {{user.email}}</a>
@else if (true)
    <a class="btn btn-outline-light" href="/login">Login</a>
@end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants