diff --git a/src/main.cr b/src/main.cr index 295dc21..31a4546 100644 --- a/src/main.cr +++ b/src/main.cr @@ -60,10 +60,10 @@ IPC::Service.new "auth" do |event| payload = message.payload pp message - case RequestTypes.new message.user_type.to_i + case RequestTypes.new message.type.to_i when RequestTypes::GetToken begin - request = GetTokenRequest.from_json payload + request = GetTokenRequest.from_json String.new payload rescue e client.send ResponseTypes::MalformedRequest.value.to_u8, e.message || "" @@ -82,7 +82,7 @@ IPC::Service.new "auth" do |event| JWT.encode user.to_h, authd_jwt_key, "HS256" when RequestTypes::AddUser begin - request = AddUserRequest.from_json payload + request = AddUserRequest.from_json String.new payload rescue e client.send ResponseTypes::MalformedRequest.value.to_u8, e.message || "" @@ -100,7 +100,7 @@ IPC::Service.new "auth" do |event| client.send ResponseTypes::Ok, user.to_json when RequestTypes::GetUserByCredentials begin - request = GetUserByCredentialsRequest.from_json payload + request = GetUserByCredentialsRequest.from_json String.new payload rescue e client.send ResponseTypes::MalformedRequest, e.message || "" next @@ -115,7 +115,7 @@ IPC::Service.new "auth" do |event| end when RequestTypes::GetUser begin - request = GetUserRequest.from_json payload + request = GetUserRequest.from_json String.new payload rescue e client.send ResponseTypes::MalformedRequest, e.message || "" next @@ -130,7 +130,7 @@ IPC::Service.new "auth" do |event| end when RequestTypes::ModUser begin - request = ModUserRequest.from_json payload + request = ModUserRequest.from_json String.new payload rescue e client.send ResponseTypes::MalformedRequest, e.message || "" next