Sha256: 7616a2ad1ef31b2c3a60d2520d0b222f5daaa3f6289ca0a919abb518948621da

Contents?: true

Size: 1.1 KB

Versions: 40

Compression:

Stored size: 1.1 KB

Contents

module Isomorfeus
  module Transport
    class SsrLogin
      def self.init
        session_id = `global.IsomorfeusSessionId`
        if session_id && session_id.size > 0
          Isomorfeus::Transport.promise_send_path('Isomorfeus::Transport::Handler::AuthenticationHandler', 'ssr_login', session_id).then do |agent|
            if agent.processed
              agent.result
            else
              agent.processed = true
              if agent.response.key?(:success)
                Isomorfeus.store.dispatch(type: 'DATA_LOAD', data: agent.response[:data])
                class_name = agent.response[:data].keys.first
                key = agent.response[:data][class_name].keys.first
                logged_in_user = Isomorfeus.cached_data_class(class_name).new(key: key)
                Isomorfeus.set_current_user(logged_in_user)
              else
                error = agent.response[:error]
                Isomorfeus.raise_error(message: "SSR Login failed, #{error}!") # triggers .fail
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
isomorfeus-transport-2.2.4 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.2.3 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.2.2 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.2.1 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.2.0 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.1.1 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.1.0 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.22 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.21 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.20 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.19 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.18 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.17 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.16 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.15 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.14 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.13 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.12 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.11 lib/isomorfeus/transport/ssr_login.rb
isomorfeus-transport-2.0.10 lib/isomorfeus/transport/ssr_login.rb