fix 500
This commit is contained in:
@@ -137,7 +137,8 @@ def index():
|
||||
@bp.route('/switch-company/<int:company_id>')
|
||||
@login_required
|
||||
def switch_company(company_id):
|
||||
CompanyService.set_active_company(company_id)
|
||||
if not CompanyService.switch_company(company_id):
|
||||
abort(403)
|
||||
return redirect(url_for('dashboard.index'))
|
||||
|
||||
|
||||
|
||||
@@ -54,3 +54,7 @@ class CompanyService:
|
||||
session['current_company_id'] = company.id
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def set_active_company(company_id, user=None):
|
||||
return CompanyService.switch_company(company_id, user=user)
|
||||
Reference in New Issue
Block a user