Skip to content

Commit

Permalink
fix: max length for letters
Browse files Browse the repository at this point in the history
  • Loading branch information
flornkm committed Mar 15, 2024
1 parent ba2703d commit f789a0a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/letters.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ export default async function handler(req, res) {
}
} else if (req.method === "POST") {
const { text, signature, handle } = req.body

if (text.length > 100) {
res.statusCode = 400
res.end()
return
}

try {
const newLetter = await push(ref(database, "letters"))
await set(newLetter, {
Expand Down
1 change: 1 addition & 0 deletions interface/sections/Letters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ function SendLetter(props: {
? setLetterWritten(true)
: setLetterWritten(false)
}}
maxLength={100}
class="w-full h-full bg-zinc-100 px-4 py-3 resize-none rounded-xl transition-all outline-transparent focus:outline-4 focus:outline-zinc-500/10 focus:border-zinc-300 outline-offset-1 border border-zinc-200 dark:bg-zinc-800 dark:border-zinc-700 dark:placeholder:text-zinc-500 dark:focus:border-zinc-600 dark:focus:outline-none"
></textarea>
</div>
Expand Down

0 comments on commit f789a0a

Please sign in to comment.