add server settings for cordova

This commit is contained in:
Tim Gröger 2021-01-29 11:51:56 +01:00
parent d396940071
commit 797f7dd67a
5 changed files with 174 additions and 940 deletions

View File

@ -13,6 +13,7 @@
"@quasar/extras": "^1.9.10", "@quasar/extras": "^1.9.10",
"@vue/composition-api": "^0.6.4", "@vue/composition-api": "^0.6.4",
"axios": "^0.21.0", "axios": "^0.21.0",
"cordova": "^10.0.0",
"core-js": "^3.7.0", "core-js": "^3.7.0",
"quasar": "^1.14.5", "quasar": "^1.14.5",
"vue-router": "3.3.2" "vue-router": "3.3.2"

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@
"author": "Apache Cordova Team", "author": "Apache Cordova Team",
"license": "Apache-2.0", "license": "Apache-2.0",
"devDependencies": { "devDependencies": {
"cordova-android": "^9.0.0",
"cordova-ios": "^6.1.1", "cordova-ios": "^6.1.1",
"cordova-plugin-whitelist": "^1.3.4" "cordova-plugin-whitelist": "^1.3.4"
}, },
@ -21,7 +22,8 @@
"cordova-plugin-whitelist": {} "cordova-plugin-whitelist": {}
}, },
"platforms": [ "platforms": [
"ios" "ios",
"android"
] ]
} }
} }

View File

@ -10,6 +10,10 @@ declare module 'vue/types/vue' {
} }
} }
export const setBaseUrl = (url: string) => {
axios.defaults.baseURL = url;
}
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;

View File

@ -36,6 +36,16 @@
</div> </div>
</q-form> </q-form>
</q-card-section> </q-card-section>
<q-card-section>
<q-separator class="q-mt-sm"/>
<div class="cordova-only q-my-sm">
<div class="text-h6">Serversettings</div>
<q-input filled label="Server" dense v-model="server" />
</div>
</q-card-section>
<q-card-actions align="right">
<q-btn dense color="primary" label="Speichern" @click="changeUrl" />
</q-card-actions>
</q-card> </q-card>
</q-page> </q-page>
</template> </template>
@ -43,6 +53,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, ref } from '@vue/composition-api'; import { defineComponent, ref } from '@vue/composition-api';
import { Loading, Notify } from 'quasar'; import { Loading, Notify } from 'quasar';
import { setBaseUrl } from 'boot/axios';
export default defineComponent({ export default defineComponent({
// name: 'PageName' // name: 'PageName'
@ -53,6 +64,13 @@ 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)
function changeUrl() {
if (server.value) {
setBaseUrl(server.value)
}
}
function doLogin() { function doLogin() {
Loading.show({ Loading.show({
@ -116,7 +134,7 @@ export default defineComponent({
}); });
} }
return { userid, password, doLogin, doReset, rules }; return { userid, password, doLogin, doReset, rules, server, changeUrl };
} }
}); });
</script> </script>