linter fixes

This commit is contained in:
Richard 2021-04-27 14:28:08 +01:00
parent 03a4f36556
commit e14800b549
2 changed files with 22 additions and 12 deletions

View file

@ -1,14 +1,24 @@
<template> <template>
<div> <div>
<form <form
class="uk-form-stacked" class="uk-form-stacked"
@submit="overrideAPIHost"
action="" action=""
method="GET"> method="GET"
@submit="overrideAPIHost"
>
<label class="uk-form-label">Override API origin</label> <label class="uk-form-label">Override API origin</label>
<input v-model="newOrigin" name="overrideOrigin" class="uk-input" type="text" /> <input
<label class="uk-form-label" > v-model="newOrigin"
<input v-model="reloadWhenOverridingOrigin" class="uk-input uk-checkbox" type="checkbox" /> name="overrideOrigin"
class="uk-input"
type="text"
/>
<label class="uk-form-label">
<input
v-model="reloadWhenOverridingOrigin"
class="uk-input uk-checkbox"
type="checkbox"
/>
Reload web app with new origin Reload web app with new origin
</label> </label>
<button class="uk-button uk-button-default uk-margin-small"> <button class="uk-button uk-button-default uk-margin-small">
@ -50,11 +60,11 @@ export default {
overrideAPIHost: function(event) { overrideAPIHost: function(event) {
// Save the origin override, so that if we reload the web app, you can easily // Save the origin override, so that if we reload the web app, you can easily
localStorage.overrideOrigin = this.newOrigin; localStorage.overrideOrigin = this.newOrigin;
// If we have elected not to reload the interface, just update the origin // If we have elected not to reload the interface, just update the origin
// in the store. Otherwise, the form's default action will do the job for us. // in the store. Otherwise, the form's default action will do the job for us.
// TODO: preserve other query parameters when reloading // TODO: preserve other query parameters when reloading
if(!this.reloadWhenOverridingOrigin){ if (!this.reloadWhenOverridingOrigin) {
this.$store.commit("changeOrigin", this.newOrigin); this.$store.commit("changeOrigin", this.newOrigin);
event.preventDefault(); event.preventDefault();
} }

View file

@ -3,15 +3,15 @@ import Vuex from "vuex";
Vue.use(Vuex); Vue.use(Vuex);
function getOriginFromLocation(){ function getOriginFromLocation() {
// This will default to the same origin that's serving // This will default to the same origin that's serving
// the web app - but can be overridden by the URL. // the web app - but can be overridden by the URL.
// See also devTools.vue which can change the origin. // See also devTools.vue which can change the origin.
let url = new URL(window.location.href); let url = new URL(window.location.href);
let origin = url.searchParams.get("overrideOrigin"); let origin = url.searchParams.get("overrideOrigin");
if(origin){ if (origin) {
return origin; return origin;
}else{ } else {
return url.origin; return url.origin;
} }
} }