From 75cb5952f4585a129ab763de3c6a1ca499d1d452 Mon Sep 17 00:00:00 2001
From: Erich Eckner <erich.eckner.ext@bestsecret.com>
Date: Fri, 3 Feb 2023 14:59:17 +0100
Subject: hand through the colors to Trial, properly create new lines when new
 trial starts

---
 src/Wordle.vue | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'src/Wordle.vue')

diff --git a/src/Wordle.vue b/src/Wordle.vue
index 4f3c32c..c57f0fa 100644
--- a/src/Wordle.vue
+++ b/src/Wordle.vue
@@ -21,7 +21,12 @@ import Trials from "@/components/Trials.vue";
 let riddle: string = "";
 let current = reactive({
   trial: "",
-  backendResponse: {},
+  backendResponse: {
+    trial: "",
+    is_in_dictionary: true,
+    is_solved: false,
+    colors: [],
+  },
 });
 
 let props = defineProps<{ length: number }>();
@@ -53,6 +58,9 @@ function submit() {
   xmlHttp.onreadystatechange = function () {
     if (this.readyState == 4 && this.status == 200) {
       current.backendResponse = JSON.parse(xmlHttp.responseText);
+      if (current.backendResponse.is_in_dictionary) {
+        current.trial = "";
+      }
     }
   };
   xmlHttp.open(
-- 
cgit v1.2.3-70-g09d2

