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

@ -107,4 +107,10 @@ export async function approveTask(runid, taskid) {
} }
let res = await fetch(apiurl(path), init) let res = await fetch(apiurl(path), init)
return res.json(); 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> </template>
<script> <script>
import { fetchRemoteSources } from "@/util/data";
import { loginurl, fetch, login, logout } from "@/util/auth";
import LoginForm from "@/components/loginform"; import LoginForm from "@/components/loginform";
import { apiurl, loginurl, fetch, login, logout } from "@/util/auth";
export default { export default {
name: "Login", name: "Login",
@ -34,8 +36,7 @@ export default {
}, },
methods: { methods: {
async getRemoteSources() { async getRemoteSources() {
let res = await (await fetch(apiurl("/remotesources"))).json(); this.remotesources = await fetchRemoteSources();
this.remotesources = res;
}, },
async doLogin(rsName, username, password) { async doLogin(rsName, username, password) {
let u = loginurl(); let u = loginurl();