about summary refs log tree commit diff
path: root/app/controllers/api/web/settings_controller.rb
blob: 601e25e6eec4c266671629755645b231ee15a774 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class Api::Web::SettingsController < Api::Web::BaseController
  before_action :require_user!
  before_action :set_setting

  def update
    @setting.update!(data: params[:data])
    render_empty
  end

  private

  def set_setting
    @setting = ::Web::Setting.where(user: current_user).first_or_initialize(user: current_user)
  end
end