8000 style: Added red color message to indicate errors · NuruProgramming/NuruIDLE@baab428 · GitHub
[go: up one dir, main page]

Skip to content

Commit baab428

Browse files
committed
style: Added red color message to indicate errors
1 parent 64c9ed8 commit baab428

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed

frontend/src/components/repl/Index.vue

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@
55
<div>
66
{{ entry.response }}
77
</div>
8+
<div v-if="entry.error" class="p-2">
9+
<el-alert
10+
title="Kosa"
11+
:description="entry.error"
12+
type="error"
13+
:closable="false" />
14+
</div>
815
</div>
9-
<el-input v-model="input" @keyup.enter="sendToEngine"></el-input>
16+
<el-input
17+
v-model="input"
18+
@keyup.enter="sendToEngine"
19+
placeholder="Andika msimbo"></el-input>
1020
</div>
1121
</template>
1222

@@ -17,37 +27,25 @@ export default {
1727
data() {
1828
return {
1929
input: "",
20-
entries: [
21-
{
22-
input: "x + 2",
23-
response: " 2",
24-
},
25-
],
30+
entries: [],
2631
};
2732
},
2833
methods: {
2934
sendToEngine() {
30-
console.log("im there");
31-
32-
Start(this.input)
33-
.then((resp, other) => {
34-
console.log("im here");
35-
this.createNewEntry(this.input, resp);
36-
console.log(resp);
37-
console.log("other", other);
38-
})
39-
.catch((error) => {
40-
console.log(error);
41-
42-
this.createNewEntry(this.input, error);
43-
console.log("im failed");
44-
});
45-
console.log("im done");
35+
Start(this.input).then((resp) => {
36+
if (resp.Errors) {
37+
this.createNewEntry(this.input, "", resp.Errors[0]);
38+
} else {
39+
this.createNewEntry(this.input, resp.Evaluated, "");
40+
}
41+
this.input = "";
42+
});
4643
},
47-
createNewEntry(item, respone) {
44+
createNewEntry(item, respone, error) {
4845
this.entries.push({
4946
input: item,
5047
response: respone,
48+
error: error,
5149
});
5250
},
5351
},

frontend/src/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,8 @@
183183
text-align: left;
184184
padding: 20px;
185185
}
186+
187+
188+
.p-2 {
189+
padding: 10px 0px;
190+
}

0 commit comments

Comments
 (0)
0