           @render 'notFound'
           pause()
 
-        if not this.data()?#or game.state is 'inprogress'
+        unless @data()?
           @render 'notFound'
           pause()
-
-        # gameId = @params._id
-        # game = null
-        # Deps.nonreactive ->
-        #   game = Games.findOne gameId
-        #   console.log game
-        # if not game? #or game.state is 'inprogress'
-        #   @render 'notFound'
-        #   pause()
 
       waitOn: ->
         Meteor.subscribe 'games'

    @route 'highscores'

    #game types
    @route 'single', path: '/single'
    @route 'duel', path: '/duel'


    # DEBUG route
    @route 'quizzes',
      path: '/quizzes/'

    # quiz
    @route 'quiz',


      # redirect user to where he came from
      if loginRedirect and loginRedirect != 'logout'
        Session.set loginRedirectKey, null
        @redirect loginRedirect
        pause()

  isLoggedOut: (pause) ->
    if Meteor.userId()?
      FlashMessages.sendWarning 'Du er allerede logget ind'
      @redirect 'lobby'
      pause()

filters = Router._filters


# client

if Meteor.isClient

  # before hooks

  Router.onBeforeAction 'loading'
  Router.onBeforeAction filters.isLoggedIn, only: [ 'logout', 'lobby', 'quiz' ]
  Router.onBeforeAction filters.isLoggedOut, only: [ 'login', 'signup' ]


  # routes

  Router.map ->
    # lobby
