login: use fetchRemoteSources

This commit is contained in:
Simone Gotti 2019-05-06 17:57:52 +02:00
parent 62c7881f2f
commit fb3509fc9d
2 changed files with 10 additions and 3 deletions

View File

@ -108,3 +108,9 @@ export async function approveTask(runid, taskid) {
let res = await fetch(apiurl(path), init)
return res.json();
}
export async function fetchRemoteSources() {
let path = "/remotesources"
let res = await fetch(apiurl(path));
return res.json();
}

View File

@ -19,8 +19,10 @@
</template>
<script>
import { fetchRemoteSources } from "@/util/data";
import { loginurl, fetch, login, logout } from "@/util/auth";
import LoginForm from "@/components/loginform";
import { apiurl, loginurl, fetch, login, logout } from "@/util/auth";
export default {
name: "Login",
@ -34,8 +36,7 @@ export default {
},
methods: {
async getRemoteSources() {
let res = await (await fetch(apiurl("/remotesources"))).json();
this.remotesources = res;
this.remotesources = await fetchRemoteSources();
},
async doLogin(rsName, username, password) {
let u = loginurl();