From 6e82d8be9e85838a7b1788413e4f9af57a7d917d Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Wed, 28 Jul 2021 12:11:38 +0300 Subject: [PATCH] added api endpoint for registrar login --- .../repp/v1/registrar/login_controller.rb | 22 +++++++++++++++++++ config/routes.rb | 5 +++++ 2 files changed, 27 insertions(+) create mode 100644 app/controllers/repp/v1/registrar/login_controller.rb diff --git a/app/controllers/repp/v1/registrar/login_controller.rb b/app/controllers/repp/v1/registrar/login_controller.rb new file mode 100644 index 000000000..501c6129c --- /dev/null +++ b/app/controllers/repp/v1/registrar/login_controller.rb @@ -0,0 +1,22 @@ +module Repp + module V1 + module Registrar + class LoginController < BaseController + api :GET, 'repp/v1/registrar/login' + desc 'check login user and return data' + + def index + @login = current_user + + # rubocop:disable Style/AndOr + render_success(data: nil) and return unless @login + # rubocop:enable Style/AndOr + + data = @login.as_json() + + render_success(data: data) + end + end + end + end +end diff --git a/config/routes.rb b/config/routes.rb index 1a3b394d1..a7f9b4302 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -72,6 +72,11 @@ Rails.application.routes.draw do get '/all_notifications', to: 'notifications#all_notifications' end end + resource :login, only: [:index] do + collection do + get '/', to: 'login#index' + end + end resources :nameservers do collection do put '/', to: 'nameservers#update'