From 6722777735cdaf9406f51ee0cf1e0370ca6e9075 Mon Sep 17 00:00:00 2001 From: Bhanu Teja P Date: Mon, 9 Sep 2019 02:02:29 +0530 Subject: [PATCH 1/2] Proxy routes --- .gitignore | 2 ++ now.json | 8 ++++++++ vue.config.js | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 now.json diff --git a/.gitignore b/.gitignore index a0dddc6..e5e096b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ yarn-error.log* *.njsproj *.sln *.sw? + +.env diff --git a/now.json b/now.json new file mode 100644 index 0000000..447bef9 --- /dev/null +++ b/now.json @@ -0,0 +1,8 @@ +{ + "routes": [ + { + "src": "/api/(.*)", + "dest": "https://openrank.herokuapp.com/api/$1" + } + ] +} diff --git a/vue.config.js b/vue.config.js index 4091ee3..1739624 100644 --- a/vue.config.js +++ b/vue.config.js @@ -2,7 +2,9 @@ module.exports = { devServer: { proxy: { '/api': { - target: 'http://localhost:8000', + target: 'https://localhost:8000', + ws: true, + changeOrigin: true, headers: { Connection: 'keep-alive', }, From c6a6596a38363719673357d954319b5614cc613a Mon Sep 17 00:00:00 2001 From: Bhanu Teja P Date: Mon, 9 Sep 2019 02:45:38 +0530 Subject: [PATCH 2/2] Automatically close alerts after 2 sec --- src/store/modules/authentication/login.js | 5 ++--- src/store/modules/authentication/register.js | 3 ++- src/store/modules/authentication/user.js | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/store/modules/authentication/login.js b/src/store/modules/authentication/login.js index c7a1c08..2bb3e7b 100644 --- a/src/store/modules/authentication/login.js +++ b/src/store/modules/authentication/login.js @@ -37,14 +37,13 @@ export default { email, password, }).then(({ data: { data: { token }, message } }) => { - console.log('TOKEN', token); commit('authentication/user/setToken', token, { root: true }); commit('setSuccessMsg', message); + setTimeout(() => commit('setSuccessMsg', null), 2000); router.push('/').catch(() => {}); }).catch(({ response }) => { - console.log('CAME HERE'); commit('setErrorMsg', rootGetters.getErrorMessage(response)); - console.log(response); + setTimeout(() => commit('setErrorMsg', null), 2000); }); }, }, diff --git a/src/store/modules/authentication/register.js b/src/store/modules/authentication/register.js index 46837bf..a73b5cd 100644 --- a/src/store/modules/authentication/register.js +++ b/src/store/modules/authentication/register.js @@ -50,9 +50,10 @@ export default { password_confirmed, }).then(({ data: { message } }) => { commit('setSuccessMsg', message); + setTimeout(() => commit('setSuccessMsg', null), 2000); }).catch(({ response }) => { commit('setErrorMsg', rootGetters.getErrorMessage(response)); - console.log(response); + setTimeout(() => commit('setErrorMsg', null), 2000); }); }, }, diff --git a/src/store/modules/authentication/user.js b/src/store/modules/authentication/user.js index 6e4ac02..658b878 100644 --- a/src/store/modules/authentication/user.js +++ b/src/store/modules/authentication/user.js @@ -58,9 +58,10 @@ export default { commit('setName', name); commit('setEmail', email); commit('setSuccessMsg', message); + setTimeout(() => commit('setSuccessMsg', null), 2000); }).catch(({ response }) => { commit('setErrorMsg', rootGetters.getErrorMessage(response)); - console.log(response); + setTimeout(() => commit('setErrorMsg', null), 2000); }); }, async updateUser({ @@ -88,9 +89,10 @@ export default { commit('setName', user.name); commit('setEmail', user.email); commit('setSuccessMSg', message); + setTimeout(() => commit('setSuccessMsg', null), 2000); }).catch(({ response }) => { commit('setErrorMsg', rootGetters.getErrorMessage(response)); - console.log(response); + setTimeout(() => commit('setErrorMsg', null), 2000); }); }, },