# frozen_string_literal: true

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

    def index
      @email_messages = EmailMessage.all
    end

    def show; end

    def destroy
      @email_message.destroy

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

    private

    def set_email_message
      @email_message = EmailMessage.find(params[:id])
    end
  end
end
