Test form for sending emails
This commit is contained in:
@@ -5,6 +5,7 @@ import { goto } from '$app/navigation';
|
||||
let to = '';
|
||||
let subject = '';
|
||||
let body = '';
|
||||
let qrcode_b64 = '';
|
||||
let loading = false;
|
||||
let error = '';
|
||||
let success = '';
|
||||
@@ -43,12 +44,13 @@ async function sendTestEmail() {
|
||||
to,
|
||||
subject,
|
||||
text: body,
|
||||
qr_code: qrcode_b64,
|
||||
refreshToken
|
||||
})
|
||||
});
|
||||
if (r.ok) {
|
||||
success = 'Email sent!';
|
||||
to = subject = body = '';
|
||||
to = subject = body = qrcode_b64 = '';
|
||||
} else {
|
||||
error = await r.text();
|
||||
}
|
||||
@@ -82,6 +84,10 @@ async function sendTestEmail() {
|
||||
<span class="text-gray-700">Body</span>
|
||||
<textarea class="mt-1 block w-full border border-gray-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-200 resize-none" rows="6" bind:value={body} required></textarea>
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="text-gray-700">QR Code (base64, data:image/png;base64,...)</span>
|
||||
<input type="text" class="mt-1 block w-full border border-gray-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-200 font-mono text-xs" bind:value={qrcode_b64} placeholder="Paste base64 image string here" required />
|
||||
</label>
|
||||
<button type="submit" class="w-full py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition" disabled={loading}>
|
||||
{#if loading}
|
||||
<svg class="animate-spin h-5 w-5 mr-2 inline-block text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
|
||||
Reference in New Issue
Block a user