Skip to content

Commit

Permalink
#9 Change vue to read conf.json file from webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
adhatama committed Jul 9, 2018
1 parent 7f3b670 commit 3595cbb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 2 additions & 3 deletions resources/js/pages/auth/#.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<script>
import Nprogres from 'nprogress'
import { mapActions, mapGetters } from 'vuex'
import config from '../../../../conf.json'
export default {
name: 'Login',
Expand Down Expand Up @@ -69,9 +68,9 @@ export default {
this.userLogin({
username: this.username,
password: this.password,
client_id: config.client_id,
client_id: process.env.CLIENT_ID,
response_type: 'token',
redirect_uri: config.redirect_uri,
redirect_uri: process.env.REDIRECT_URI,
state: 'random-string',
}).then(this.redirector)
.catch(() => this.$toasted.error('Incorrect Username and/or password'))
Expand Down
9 changes: 8 additions & 1 deletion webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const webpack = require('webpack');
const path = require('path');
const glob = require('glob-all');
const fs = require('fs')
const confJSON = require('./conf.json');

const HtmlWebpackPlugin = require('html-webpack-plugin');
const PurifyCSSPlugin = require('purifycss-webpack');
Expand Down Expand Up @@ -67,7 +68,13 @@ mix.webpackConfig({
chunkSortMode: 'dependency',
serviceWorkerLoader: `<script>${fs.readFileSync(path.join(__dirname,
mix.inProduction() ? './resources/js/service-worker-prod.js' : './resources/js/service-worker-dev.js'), 'utf-8')}</script>`
})
}),
new webpack.DefinePlugin({
'process.env': {
REDIRECT_URI: JSON.stringify(confJSON.redirect_uri),
CLIENT_ID: JSON.stringify(confJSON.client_id)
},
}),
],
resolve: {
extensions: [
Expand Down

0 comments on commit 3595cbb

Please # to comment.