Skip to content

Commit

Permalink
🐛 Fix minor issues on demo webapp
Browse files Browse the repository at this point in the history
  • Loading branch information
ujibang committed Sep 27, 2024
1 parent 59d5d55 commit 0203c30
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/mongodb-rest/demo-webapp.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h5>&gt;</h5>
</div>
</section>
<dialog id="postMsgDialog">
<form>
<form id="postMsgForm">
<article class="mw-600 p-4">
<header>
<button aria-label="Close" rel="prev" @click="postMsgDialog.close()"></button>
Expand All @@ -52,7 +52,7 @@ <h3>Post your message</h3>
</hgroup>

<footer>
<button @click="post(from, message); page = 1; docs = await fetchDocs(page)">Post</button>
<button type="button" @click="if (document.getElementById('postMsgForm').checkValidity()) { await post(from, message); page = 1; docs = await fetchDocs(page); postMsgDialog.close(); postMsgForm.reset(); }">Post</button>
</footer>
</article>
</form>
Expand All @@ -64,7 +64,7 @@ <h3>Post your message</h3>
<script>
const fetchDocs = (page) =>
fetch(
encodeURI(`https://demo.restheart.org/messages?page=${page}&pagesize=8`)
encodeURI(`https://demo.restheart.org/messages?page=${page}&pagesize=8&filter={"from":{"$exists":true},"message":{"$exists":true}}`)
).then((response) => response.json());

const post = (from, message) =>
Expand Down Expand Up @@ -104,7 +104,8 @@ <h3>Post your message</h3>
}

.mw-600 {
min-width: 600px;
width: 90vw;
max-width: 600px;
}

.text-center {
Expand Down

0 comments on commit 0203c30

Please sign in to comment.