initial commit
This commit is contained in:
18
app/controllers/main_controller.rb
Normal file
18
app/controllers/main_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'teamsnap'
|
||||
class MainController < ApplicationController
|
||||
include SessionsHelper
|
||||
before_action :logged_in_user
|
||||
def index
|
||||
TeamSnap.init(token: @credentials['token'],
|
||||
headers: { 'Authorization' => "Bearer #{@credentials['token']}" })
|
||||
@teamsnap_client = TeamSnap.root_client
|
||||
if session[:team_id]
|
||||
redirect_to team_path(team_id: session[:team_id])
|
||||
else
|
||||
teams = TeamSnap::Team.search(@teamsnap_client, { user_id: @user_id })
|
||||
redirect_to team_list_url
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user