Sha256: b66cb46815e965ebb5b27283037729bb17b1750aeea3886ad903728ae5f5ced5

Contents?: true

Size: 1.06 KB

Versions: 11

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module GraphqlDevise
  module MailerHelper
    def confirmation_query(resource_name:, token:, redirect_url:)
      name = "#{resource_name.underscore.tr('/', '_').camelize(:lower)}ConfirmAccount"
      raw = <<-GRAPHQL
        query($token:String!,$redirectUrl:String!){
          #{name}(confirmationToken:$token,redirectUrl:$redirectUrl){
            email
          }
        }
      GRAPHQL

      {
        query:     raw.delete("\n").delete(' ').html_safe,
        variables: { token: token, redirectUrl: redirect_url }
      }
    end

    def password_reset_query(token:, redirect_url:, resource_name:)
      name = "#{resource_name.underscore.tr('/', '_').camelize(:lower)}CheckPasswordToken"
      raw = <<-GRAPHQL
        query($token:String!,$redirectUrl:String!){
          #{name}(resetPasswordToken:$token,redirectUrl:$redirectUrl){
            email
          }
        }
      GRAPHQL

      {
        query:     raw.delete("\n").delete(' ').html_safe,
        variables: { token: token, redirectUrl: redirect_url }
      }
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
graphql_devise-0.14.3 app/helpers/graphql_devise/mailer_helper.rb
graphql_devise-0.14.2 app/helpers/graphql_devise/mailer_helper.rb
graphql_devise-0.14.1 app/helpers/graphql_devise/mailer_helper.rb
graphql_devise-0.14.0 app/helpers/graphql_devise/mailer_helper.rb
graphql_devise-0.13.6 app/helpers/graphql_devise/mailer_helper.rb
graphql_devise-0.13.5 app/helpers/graphql_devise/mailer_helper.rb
graphql_devise-0.13.4 app/helpers/graphql_devise/mailer_helper.rb
graphql_devise-0.13.3 app/helpers/graphql_devise/mailer_helper.rb
graphql_devise-0.13.2 app/helpers/graphql_devise/mailer_helper.rb
graphql_devise-0.13.1 app/helpers/graphql_devise/mailer_helper.rb
graphql_devise-0.13.0 app/helpers/graphql_devise/mailer_helper.rb