diff --git a/assets/.babelrc b/assets/.babelrc new file mode 100644 index 0000000..f6d7098 --- /dev/null +++ b/assets/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": "env" +} \ No newline at end of file diff --git a/assets/src/index.js b/assets/src/index.js index 9f8f656..a8d1f6a 100644 --- a/assets/src/index.js +++ b/assets/src/index.js @@ -4,10 +4,10 @@ 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) -import auth from './auth' // Set default auth header Vue.http.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('id_token'); @@ -15,7 +15,21 @@ Vue.http.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('id_ // Check the user's auth status when the app starts auth.checkAuth() -export var router = new VueRouter() +//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': { @@ -30,4 +44,4 @@ router.redirect({ '*': '/home' }) -router.start(App, '#app') \ No newline at end of file +router.start(App, '#app')*/ \ No newline at end of file diff --git a/assets/webpack.config.js b/assets/webpack.config.js index 750bcf1..7a8b1f7 100644 --- a/assets/webpack.config.js +++ b/assets/webpack.config.js @@ -1,7 +1,9 @@ // TODO: -// * EsLint // * bessere struktur +function resolve (dir) { + return path.join(__dirname, '..', dir) +} module.exports = { // the main entry of our app @@ -9,8 +11,12 @@ module.exports = { // output configuration output: { path: __dirname + '/dist/', - publicPath: 'assets/dist/', - filename: 'app.js' + publicPath: 'assets/dist/' + }, + resolve: { + alias: { + vue: 'vue/dist/vue.min.js' + } }, // how modules should be transformed module: { @@ -24,13 +30,18 @@ module.exports = { // the exclude pattern is important so that we don't // apply babel transform to all the dependencies! { - test: /\.js$/, - exclude: /(node_modules|bower_components)/, + /* test: /\.js$/, + //exclude: /(node_modules)/, use: { loader: 'babel-loader', /*options: { presets: ['@babel/preset-env'] - }*/ + }* + }*/ + test: /\.js?$/, + loader: 'babel-loader', + query: { + presets: ['env'] } } ]