'use strict'

class IndexController {
  async index({auth, view}) {
    try {
      await auth.check();
      return view.render('home');
    } catch (e) {
      const bgIndex = Math.ceil((Math.random() * 10) % 5);
      return view.render('landing', {bgIndex});
    }
  }
}

module.exports = IndexController
