fix: simplify form styles and handle missing auth config
- Remove excessive form styling, keep minimal - Wrap getSession in try-catch for dev without env vars
This commit is contained in:
parent
892afc2161
commit
3600897f4b
2 changed files with 8 additions and 34 deletions
|
|
@ -6,7 +6,12 @@ import { getPendingEntries, type GuestbookEntry } from '../lib/db';
|
||||||
import { isAdmin } from '../lib/auth';
|
import { isAdmin } from '../lib/auth';
|
||||||
import '../styles/global.css';
|
import '../styles/global.css';
|
||||||
|
|
||||||
const session = await getSession(Astro.request);
|
let session;
|
||||||
|
try {
|
||||||
|
session = await getSession(Astro.request);
|
||||||
|
} catch {
|
||||||
|
return new Response('Auth not configured', { status: 500 });
|
||||||
|
}
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
return Astro.redirect('/api/auth/signin');
|
return Astro.redirect('/api/auth/signin');
|
||||||
|
|
|
||||||
|
|
@ -48,46 +48,15 @@ details pre {
|
||||||
}
|
}
|
||||||
|
|
||||||
#guestbook-form {
|
#guestbook-form {
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.5rem;
|
|
||||||
padding-left: 1rem;
|
|
||||||
margin-top: 0.5rem;
|
margin-top: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#guestbook-form input,
|
#guestbook-form input,
|
||||||
#guestbook-form textarea {
|
#guestbook-form textarea,
|
||||||
font-family: monospace;
|
|
||||||
font-size: 1rem;
|
|
||||||
padding: 0.25rem;
|
|
||||||
border: 1px solid #888;
|
|
||||||
background: transparent;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
#guestbook-form textarea {
|
|
||||||
min-height: 3rem;
|
|
||||||
resize: vertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
#guestbook-form button {
|
#guestbook-form button {
|
||||||
font-family: monospace;
|
font: inherit;
|
||||||
font-size: 1rem;
|
|
||||||
padding: 0.25rem 0.5rem;
|
|
||||||
cursor: pointer;
|
|
||||||
background: transparent;
|
|
||||||
border: 1px solid #888;
|
|
||||||
color: inherit;
|
|
||||||
align-self: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
#guestbook-form button:hover {
|
|
||||||
background: #888;
|
|
||||||
color: #000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#guestbook-status {
|
#guestbook-status {
|
||||||
padding-left: 1rem;
|
|
||||||
color: #888;
|
color: #888;
|
||||||
font-family: monospace;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue