import Vue from 'vue'
import App from './components/App.vue'
import Home from './components/Home.vue'
import Login from './components/Login.vue'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import auth from './auth'

Vue.use(VueResource)
Vue.use(VueRouter)

// Set default auth header
Vue.http.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('id_token');

// Check the user's auth status when the app starts
auth.checkAuth()

//export var router = new VueRouter()

const routes = [
    { path: '/home', component: Home },
    { path: '/login', component: Login }
]

export const router = new VueRouter({
    routes // kurz für 'routes: routes'
})

const app = new Vue({
    router
}).$mount('#app')
/*

router.map({
    '/home': {
        component: Home
    },
    '/login': {
        component: Login
    }
})

router.redirect({
    '*': '/home'
})

router.start(App, '#app')*/