Skip to content

Commit e362ca2

Browse files
committed
Add prompt for querying
1 parent ef30d88 commit e362ca2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/routes/+page.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
44
let 字頭們 = '';
55
let results = [] as string[][];
6+
let pending = false;
67
78
const fetchData = async () => {
89
if (字頭們.length) {
910
const response = await fetch(`https://chinese-dialect-pronunciation-atlas-beg4zxgxla-wl.a.run.app/query?string=${字頭們}`);
1011
results = await response.json() as string[][];
1112
}
13+
pending = false;
1214
};
1315
1416
const handleSubmit = () => {
17+
pending = true;
1518
fetchData();
1619
};
1720
</script>
@@ -56,6 +59,9 @@ form > * {
5659
<input type="submit" value="查詢">
5760
</form>
5861

62+
{#if pending}
63+
<p>正在查詢,請稍候……</p>
64+
{/if}
5965
<DataTable results={results}/>
6066

6167
<footer>

0 commit comments

Comments
 (0)