# frozen_string_literal: true

# module settings
module Settings
  # Users
  class FilterForEmailsController < ApplicationController
    before_action :authenticate_user!
    before_action :set_filter_for_email, only: %i[show destroy]

    def index
      @filter_for_emails = FilterForEmail.all
    end

    def show; end

    def destroy
      @filter_for_email.destroy

      respond_to do |format|
        format.html { redirect_to settings_filter_for_emails_url, notice: 'Usunięto pomyślnie.' }
        format.json { head :no_content }
      end
    end

    private

    def set_filter_for_email
      @filter_for_email = FilterForEmail.find(params[:id])
    end
  end
end
