hackatime/app/controllers/api/v1/authenticated/api_keys_controller.rb
2025-10-03 21:05:28 -04:00

17 lines
342 B
Ruby

module Api
module V1
module Authenticated
class ApiKeysController < ApplicationController
def index
render json: { token: api_key.token }
end
private
def api_key
@api_key ||= current_user.api_keys.first || current_user.api_keys.create!
end
end
end
end
end