1
0
Fork 0
mirror of https://github.com/Findus23/cr-search.git synced 2024-09-19 15:23:44 +02:00

better suggestion errors

This commit is contained in:
Lukas Winkler 2021-07-18 11:18:09 +02:00
parent a5e52b115c
commit 7eccd00405
Signed by: lukas
GPG key ID: 54DE4D798D244853
2 changed files with 12 additions and 5 deletions

View file

@ -1,7 +1,7 @@
import random
from typing import List
from flask import request, jsonify, Response
from flask import request, jsonify, Response, abort
from peewee import fn, Alias, SQL, DoesNotExist, Expression, ModelSelect, JOIN
from playhouse.postgres_ext import TS_MATCH
from playhouse.shortcuts import model_to_dict
@ -200,7 +200,7 @@ def api_suggestion():
until = request.args.get('until')
series = request.args.get('series')
if series not in suggestions:
return 404
abort(404)
all_suggestions = suggestions[series]
if until == "-":
possible_suggestions = [s.text for s in all_suggestions]

View file

@ -310,15 +310,22 @@ export default Vue.extend({
+ "&series=" + this.$route.params.series;
fetch(url)
.then((response) => response.text())
.then((response) => {
if (!response.ok) {
throw new Error();
}
return response.text();
})
.then((data) => {
this.placeholderFullText = data;
clearTimeout(this.placeholderTimeout);
this.placeholderText = "";
this.typing(0);
// const waitTime = 150 * this.placeholderFullText.length + 5000;
// setTimeout(this.untype, waitTime);
})
.catch((error) => {
this.placeholderTimeout = setTimeout(this.startTyping, 5000);
});
},
typing(index: number): void {
if (index === this.placeholderFullText.length) {