Last active
August 30, 2017 22:52
-
-
Save mndvns/41bc948f73831b097f5634e8e880396f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
state = %Web.Users.User_.GET.State{ | |
bypass: false, | |
auth: nil, | |
user: nil, | |
} | |
assert state == Web.Users.User_.GET.state() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Web.Users.User_.GET do | |
use Mazurka.Resource | |
option bypass \\ false | |
option :skip do | |
true | |
end | |
input auth | |
param user | |
mediatype Hyper do | |
action %State{auth: nil} do | |
%{ | |
"error" => "no auth" | |
} | |
end | |
action %{auth: "admin"} = state do | |
action(%{state | bypass: true}) | |
end | |
action %{bypass: true, user: user} do | |
# does some special stuff | |
end | |
action %{user: user} do | |
# does some regular stuff | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment