Module: StartupjsHelper

Defined in:
app/helpers/startupjs_helper.rb

Instance Method Summary collapse

Instance Method Details

#add_page_startup_graphql_call(query, variables = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'app/helpers/startupjs_helper.rb', line 15

def add_page_startup_graphql_call(query, variables = {})
  @graphql_startup_calls ||= []
  file_location = File.join(Rails.root, "app/graphql/queries/#{query}.query.graphql")

  return unless File.exist?(file_location)

  query_str = File.read(file_location)
  @graphql_startup_calls << { query: query_str, variables: variables }
end

#page_startup_graphql_callsObject



4
5
6
# File 'app/helpers/startupjs_helper.rb', line 4

def page_startup_graphql_calls
  @graphql_startup_calls
end

#page_startup_graphql_headersObject



8
9
10
11
12
13
# File 'app/helpers/startupjs_helper.rb', line 8

def page_startup_graphql_headers
  {
    'X-CSRF-Token' => form_authenticity_token,
    'x-gitlab-feature-category' => ::Gitlab::ApplicationContext.current_context_attribute(:feature_category).presence || ''
  }
end