Create a new test when visiting /test/
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2025-10-20 12:27:49 +07:00
commit ed5b57ea19
2 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1,18 @@
import { error, redirect, type Load } from "@sveltejs/kit";
import { createTest as apiCreateTest } from "$lib/api";
export const load: Load = async ({ }) => {
let response;
try {
response = await apiCreateTest();
} catch (err) {
error(err.response.status, err.message);
}
if (response.response.ok) {
redirect(302, `/test/${response.data.id}`);
} else {
error(response.response.status, response.error);
}
}

View file

@ -133,7 +133,7 @@
<!-- Test Again Button -->
<div class="row">
<div class="col-12 text-center">
<a href="/" class="btn btn-primary btn-lg">
<a href="/test/" class="btn btn-primary btn-lg">
<i class="bi bi-arrow-repeat me-2"></i>
Test Another Email
</a>