This commit is contained in:
2022-02-10 16:07:29 +00:00
parent c693625e34
commit 21dcd7837b
8 changed files with 46 additions and 38 deletions

View File

@@ -1,5 +1,7 @@
<script lang="ts">
import { defineComponent, PropType } from "vue"
import { useAPI } from "../stores/api";
import { useBudgetsStore } from "../stores/budget";
export interface Suggestion {
ID : string
@@ -40,16 +42,17 @@ export default defineComponent({
return;
}
fetch("/api/v1/budget/" + this.$store.getters.CurrentBudget.ID + "/autocomplete/" + this.type + "?s=" + text, {
headers: this.$store.getters.AuthHeaders
}) .then(x=>x.json())
.then(x => {
let suggestions = x || [];
if(suggestions.length > 10){
suggestions = suggestions.slice(0, 10);
}
this.$data.Suggestions = suggestions;
});
const api = useAPI();
const budgetStore = useBudgetsStore();
api.GET("/budget/" + budgetStore.CurrentBudgetID + "/autocomplete/" + this.type + "?s=" + text)
.then(x=>x.json())
.then(x => {
let suggestions = x || [];
if(suggestions.length > 10){
suggestions = suggestions.slice(0, 10);
}
this.$data.Suggestions = suggestions;
});
},
keypress(e : KeyboardEvent) {
console.log(e.key);