From feaeb3f4e45219002048d258b008e05327dcc3dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Fri, 29 Jan 2021 14:06:25 +0100 Subject: [PATCH] fixed errors, persist save of server (cordova) --- src/boot/axios.ts | 20 +++++++++++-- src/components/utils/IsoDateInput.vue | 2 +- src/pages/Login.vue | 29 ++++++++++++++----- .../components/management/CreateEvent.vue | 14 ++++----- .../schedule/components/management/Job.vue | 12 ++++---- 5 files changed, 53 insertions(+), 24 deletions(-) diff --git a/src/boot/axios.ts b/src/boot/axios.ts index bde608f..e6a8bc6 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -3,6 +3,9 @@ import { boot } from 'quasar/wrappers'; import config from '../config'; import { Store } from 'vuex'; import { StateInterface } from 'src/store'; +import { LocalStorage } from 'quasar'; +import {Notify} from 'quasar'; +import {Router} from 'src/router'; declare module 'vue/types/vue' { interface Vue { @@ -11,14 +14,27 @@ declare module 'vue/types/vue' { } export const setBaseUrl = (url: string) => { + LocalStorage.set('baseURL', url); axios.defaults.baseURL = url; + Notify.create({ + message: "Serveraddresse gespeichert", + position: "bottom", + caption: `${url}`, + color: "positive" + }) + setTimeout(() => {window.location.reload()}, 5000) + } export default boot>(({ Vue, store, router }) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access Vue.prototype.$axios = axios; - axios.defaults.baseURL = config.baseURL; - + const baseURL = LocalStorage.getItem('baseURL'); + if (baseURL){ + axios.defaults.baseURL = baseURL + } else { + axios.defaults.baseURL = config.baseURL; + } /*** * Intercept requests and insert Token if available */ diff --git a/src/components/utils/IsoDateInput.vue b/src/components/utils/IsoDateInput.vue index 8e11456..d29f0bd 100644 --- a/src/components/utils/IsoDateInput.vue +++ b/src/components/utils/IsoDateInput.vue @@ -43,7 +43,7 @@ interface Props { label?: string; readonly: boolean; type: string; - rules: Array; + rules: Array; } export default defineComponent({ diff --git a/src/pages/Login.vue b/src/pages/Login.vue index 33deb36..5a0a048 100644 --- a/src/pages/Login.vue +++ b/src/pages/Login.vue @@ -35,17 +35,25 @@ + +
+ +
+ + +
+ - -
-
Serversettings
+ +
Servereinstellung
-
+ +
- - - + +
+
@@ -65,6 +73,11 @@ export default defineComponent({ const password = ref(''); const rules = [(val: string) => (val && val.length > 0) || 'Feld darf nicht leer sein!']; const server = ref(root.$axios.defaults.baseURL) + const visible = ref(false); + + function openServerSettings() { + visible.value = !visible.value + } function changeUrl() { if (server.value) { @@ -134,7 +147,7 @@ export default defineComponent({ }); } - return { userid, password, doLogin, doReset, rules, server, changeUrl }; + return { userid, password, doLogin, doReset, rules, server, changeUrl, visible, openServerSettings }; } }); diff --git a/src/plugins/schedule/components/management/CreateEvent.vue b/src/plugins/schedule/components/management/CreateEvent.vue index 6999bdb..9080ed7 100644 --- a/src/plugins/schedule/components/management/CreateEvent.vue +++ b/src/plugins/schedule/components/management/CreateEvent.vue @@ -45,12 +45,12 @@ @@ -149,7 +149,7 @@ export default defineComponent({ event.value.id = NaN; event.value.start = new Date(); event.value.description = ''; - delete event.value['type']; + event.value.type = {id: -1, name: ''}; event.value.jobs = [Object.assign({}, newJob.value)]; } function notEmpty(val: string) { diff --git a/src/plugins/schedule/components/management/Job.vue b/src/plugins/schedule/components/management/Job.vue index d0e3251..f10a377 100644 --- a/src/plugins/schedule/components/management/Job.vue +++ b/src/plugins/schedule/components/management/Job.vue @@ -89,33 +89,33 @@ export default defineComponent({ function setStart(value: Date) { // eslint-disable-next-line @typescript-eslint/no-unsafe-call - emit('setStart', { job: props.job, value }); + emit('set-start', { job: props.job, value }); } function setEnd(value: Date) { // eslint-disable-next-line @typescript-eslint/no-unsafe-call - emit('setEnd', { job: props.job, value }); + emit('set-end', { job: props.job, value }); } function setComment(value: string) { // eslint-disable-next-line @typescript-eslint/no-unsafe-call - emit('setComment', { job: props.job, value }); + emit('set-comment', { job: props.job, value }); } function setJobType(value: FG.JobType) { // eslint-disable-next-line @typescript-eslint/no-unsafe-call console.log('setJobType', value); - emit('setJobType', { job: props.job, value }); + emit('set-job-type', { job: props.job, value }); } function setRequired(value: number) { // eslint-disable-next-line @typescript-eslint/no-unsafe-call - emit('setRequired', { job: props.job, value }); + emit('set-required', { job: props.job, value }); } function removeJob() { // eslint-disable-next-line @typescript-eslint/no-unsafe-call - emit('removeJob'); + emit('remove-job'); } function notEmpty(val: string) {