version 0.4.0 prepare to evolution-api

This commit is contained in:
Gabriel Pastori
2023-12-11 14:58:47 -03:00
parent 6191c8b3f2
commit f77436c5ce
5 changed files with 23 additions and 9 deletions

View File

@@ -141,6 +141,8 @@
import { useAppStore } from "@/store/app";
import AboutModal from "./About.vue";
import ShareConnection from "./ShareConnection.vue";
const BASE_URL = import.meta.env.BASE_URL;
export default {
components: { AboutModal, ShareConnection },
name: "SettingsModal",
@@ -149,7 +151,7 @@ export default {
valid: false,
revelPassword: false,
connection: {
host: "",
host: BASE_URL ? window.location.origin : "",
globalApiKey: "",
},
loading: false,
@@ -161,7 +163,6 @@ export default {
share() {
const connection = Object.assign({}, this.AppStore.connection);
this.$refs.share.open(connection);
},
logout() {
this.AppStore.logout();
@@ -192,6 +193,8 @@ export default {
open() {
this.dialog = true;
this.connection = Object.assign({}, this.AppStore.connection);
if (!this.connection.host && BASE_URL.startsWith("/manager"))
this.connection.host = window.location.origin;
},
},
watch: {

View File

@@ -77,9 +77,14 @@ export default {
},
},
async mounted() {
const urlConnection = await this.loadConnectionFromUrl();
if (!urlConnection) await this.AppStore.loadConnection();
if (!this.AppStore.validConnection) this.openSettings();
try {
const urlConnection = await this.loadConnectionFromUrl();
if (!urlConnection) await this.AppStore.loadConnection();
} catch (e) {
console.error(e);
} finally {
if (!this.AppStore.validConnection) this.openSettings();
}
},
};
</script>