RestURL static const

This commit is contained in:
s-prechtl 2023-01-20 15:34:36 +01:00
parent 8a538bb85f
commit c052d08e0e
4 changed files with 11 additions and 6 deletions

View file

@ -34,6 +34,7 @@ import Header from './components/Header.vue';
import "bootstrap/dist/css/bootstrap.min.css";
import "bootstrap/dist/js/bootstrap.min.js";
import Login from "@/components/Login.vue";
import {Rest} from "@/model/Rest";
export default defineComponent({
name: 'App',
@ -49,14 +50,13 @@ export default defineComponent({
userScores: {},
userId: 1,
user: null,
restUrl:'http://localhost:3000',
}
},
methods: {
async fetchFromApi(path: string, method: "GET" | "POST") {
let res: Response = await fetch(this.restUrl + path, {method: method,});
let res: Response = await fetch(Rest.URL + path, {method: method,});
return await res.json();
},
async fetchUserScores() {