Prettier, committed to prevent conflicts

This commit is contained in:
Ferdinand Thiessen 2021-01-29 20:10:53 +01:00
parent 284533742d
commit 99d3acaef5
2 changed files with 37 additions and 30 deletions

View File

@ -4,8 +4,7 @@ import config from '../config';
import { Store } from 'vuex'; import { Store } from 'vuex';
import { StateInterface } from 'src/store'; import { StateInterface } from 'src/store';
import { LocalStorage } from 'quasar'; import { LocalStorage } from 'quasar';
import {Notify} from 'quasar'; import { Notify } from 'quasar';
import {Router} from 'src/router';
declare module 'vue/types/vue' { declare module 'vue/types/vue' {
interface Vue { interface Vue {
@ -17,21 +16,22 @@ export const setBaseUrl = (url: string) => {
LocalStorage.set('baseURL', url); LocalStorage.set('baseURL', url);
axios.defaults.baseURL = url; axios.defaults.baseURL = url;
Notify.create({ Notify.create({
message: "Serveraddresse gespeichert", message: 'Serveraddresse gespeichert',
position: "bottom", position: 'bottom',
caption: `${url}`, caption: `${url}`,
color: "positive" color: 'positive'
}) });
setTimeout(() => {window.location.reload()}, 5000) setTimeout(() => {
window.location.reload();
} }, 5000);
};
export default boot<Store<StateInterface>>(({ Vue, store, router }) => { export default boot<Store<StateInterface>>(({ Vue, store, router }) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
Vue.prototype.$axios = axios; Vue.prototype.$axios = axios;
const baseURL = <string | undefined>LocalStorage.getItem('baseURL'); const baseURL = <string | undefined>LocalStorage.getItem('baseURL');
if (baseURL){ if (baseURL) {
axios.defaults.baseURL = baseURL axios.defaults.baseURL = baseURL;
} else { } else {
axios.defaults.baseURL = config.baseURL; axios.defaults.baseURL = config.baseURL;
} }

View File

@ -35,13 +35,11 @@
<q-btn label="Login" type="submit" color="primary" tabindex="3" /> <q-btn label="Login" type="submit" color="primary" tabindex="3" />
</div> </div>
</q-form> </q-form>
</q-card-section> </q-card-section>
<div class="row justify-end"> <div class="row justify-end">
<q-btn flat round icon="mdi-menu-down" class="cordova-only" @click="openServerSettings"/> <q-btn flat round icon="mdi-menu-down" class="cordova-only" @click="openServerSettings" />
</div> </div>
<q-slide-transition class="cordova-only"> <q-slide-transition class="cordova-only">
<div v-show="visible"> <div v-show="visible">
<q-separator /> <q-separator />
<q-card-section> <q-card-section>
@ -51,7 +49,6 @@
<q-btn size="xs" dense color="primary" label="Speichern" type="submit" /> <q-btn size="xs" dense color="primary" label="Speichern" type="submit" />
</q-form> </q-form>
</q-card-section> </q-card-section>
</div> </div>
</q-slide-transition> </q-slide-transition>
</q-card> </q-card>
@ -72,16 +69,16 @@ export default defineComponent({
const userid = ref(''); const userid = ref('');
const password = ref(''); const password = ref('');
const rules = [(val: string) => (val && val.length > 0) || 'Feld darf nicht leer sein!']; const rules = [(val: string) => (val && val.length > 0) || 'Feld darf nicht leer sein!'];
const server = ref<string|undefined>(root.$axios.defaults.baseURL) const server = ref<string | undefined>(root.$axios.defaults.baseURL);
const visible = ref(false); const visible = ref(false);
function openServerSettings() { function openServerSettings() {
visible.value = !visible.value visible.value = !visible.value;
} }
function changeUrl() { function changeUrl() {
if (server.value) { if (server.value) {
setBaseUrl(server.value) setBaseUrl(server.value);
} }
} }
@ -147,7 +144,17 @@ export default defineComponent({
}); });
} }
return { userid, password, doLogin, doReset, rules, server, changeUrl, visible, openServerSettings }; return {
userid,
password,
doLogin,
doReset,
rules,
server,
changeUrl,
visible,
openServerSettings
};
} }
}); });
</script> </script>