diff --git a/.env b/.env index 4af1806..dacd4e3 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ -VUE_APP_API_URL=http://localhost:3005 \ No newline at end of file +VUE_APP_API_URL=http://localhost:3005 +VUE_APP_SYSTEM_API_URL=http://localhost:3333 \ No newline at end of file diff --git a/.env.production b/.env.production index 75a66d8..a1c5249 100644 --- a/.env.production +++ b/.env.production @@ -1 +1,2 @@ -VUE_APP_API_URL=/api \ No newline at end of file +VUE_APP_API_URL=/api +VUE_APP_SYSTEM_API_URL=/manager-api \ No newline at end of file diff --git a/.env.staging b/.env.staging index 75a66d8..a1c5249 100644 --- a/.env.staging +++ b/.env.staging @@ -1 +1,2 @@ -VUE_APP_API_URL=/api \ No newline at end of file +VUE_APP_API_URL=/api +VUE_APP_SYSTEM_API_URL=/manager-api \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 61cd6e0..6a1cd89 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,8 @@ @@ -18,29 +11,12 @@ diff --git a/src/components/Channels/Channel.vue b/src/components/Channels/Channel.vue index bd0dfca..05c1b84 100644 --- a/src/components/Channels/Channel.vue +++ b/src/components/Channels/Channel.vue @@ -53,7 +53,7 @@ @@ -299,4 +393,27 @@ export default { transform: translate3d(40px, 0, 0); opacity: 0; } + +// Loading transitions + +.loading-enter-active, +.loading-leave-active { + transition: opacity 0.4s ease; +} +.loading-enter { + opacity: 0; + // filter: blur(70px); +} +.loading-enter-to { + opacity: 1; + // filter: blur(0); +} +.loading-leave { + opacity: 1; + // filter: blur(0); +} +.loading-leave-to { + opacity: 0; + // filter: blur(70px); +} diff --git a/src/router/index.js b/src/router/index.js index 033a013..f391354 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,7 +1,7 @@ import Vue from "vue"; import VueRouter from "vue-router"; -import store from "../store"; +import store from "@/store"; import TransitionWrapperLayout from "../layouts/TransitionWrapperLayout.vue"; import SimpleLayout from "../layouts/SimpleLayout.vue"; diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 569413c..4948054 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,7 +1,9 @@ +import API from "@/helpers/api"; + // Initial state const state = () => ({ name: "Satoshi", - jwt: window.localStorage.getItem("jwt") ? window.localStorage.getItem("jwt") : "" + jwt: window.localStorage.getItem("jwt") || "" }); // Functions to update the state directly @@ -14,11 +16,25 @@ const mutations = { // Functions to get data from the API const actions = { - login({ commit }) { - commit("setJWT", "true"); + async login({ commit }, password) { + + const { data } = await API.post( + `${process.env.VUE_APP_SYSTEM_API_URL}/v1/account/login`, + { password } + ); + + if (data && data.jwt) { + commit("setJWT", data.jwt); + } }, logout({ commit }) { commit("setJWT", ""); + }, + async refreshJWT({ commit }) { + const { data } = await API.post(`${process.env.VUE_APP_SYSTEM_API_URL}/v1/account/refresh`); + if (data && data.jwt) { + commit("setJWT", data.jwt); + } } }; diff --git a/src/views/Login.vue b/src/views/Login.vue index d246505..5ec0251 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -67,11 +67,11 @@ export default { methods: { authenticateUser() { this.isLoggingIn = true; - window.setTimeout(() => { + window.setTimeout(async () => { //if testnet, password is "printergobrrr" if (window.location.host === "testnet.getumbrel.com") { if (this.password === "printergobrrr") { - this.$store.dispatch("user/login"); + this.$store.dispatch("user/login", this.password); return this.$router.push( this.$router.history.current.query.redirect || "/dashboard" ); @@ -83,13 +83,21 @@ export default { //if locally, then any password will work, except "incorrect" if (this.password !== "incorrect") { - this.$store.dispatch("user/login"); + try { + await this.$store.dispatch("user/login", this.password); + } catch (error) { + if ( + error.response && + error.response.data === "Incorrect password" + ) { + this.isIncorrectPassword = true; + this.isLoggingIn = false; + return; + } + } return this.$router.push( this.$router.history.current.query.redirect || "/dashboard" ); - } else { - this.isIncorrectPassword = true; - return (this.isLoggingIn = false); } }, 1000); } diff --git a/src/views/Settings.vue b/src/views/Settings.vue index d42cabd..1fd6fae 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -17,27 +17,21 @@
Bitcoin - Run Bitcoin Core on Tor + Run Bitcoin Core on Tor
Lightning Network - Run Lightning on Tor + Run Lightning on Tor
Remote Access - Remotely access your Umbrel on Tor + Remotely access your Umbrel on Tor
@@ -50,6 +44,7 @@