aboutsummaryrefslogtreecommitdiff
path: root/src/components/Form.astro
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/Form.astro')
-rw-r--r--src/components/Form.astro16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/components/Form.astro b/src/components/Form.astro
index 540a4d4..93192a0 100644
--- a/src/components/Form.astro
+++ b/src/components/Form.astro
@@ -1,20 +1,17 @@
---
-import { sha256 } from 'js-sha256';
-
export interface Props {
board: string;
tid?: string
}
const { board, tid } = Astro.props;
-const iphash = sha256(Astro.clientAddress);
---
<div class="blackbox">
<slot />
</div>
-<script define:vars={{ board, iphash, tid }}>
+<script define:vars={{ board, tid }}>
document.forms['form'].addEventListener('submit', async (event) => {
event.preventDefault();
@@ -34,16 +31,17 @@ const iphash = sha256(Astro.clientAddress);
}).then(async (r) => {
if(r.status == 200) {
alert('Thread Successfuly Posted');
- let id = await r.text();
- if(id == 'close') window.top.close();
- window.location.assign(`/board/${board}/${id}`);
+ let t = await r.text();
+ if(t == 'close') window.top.close();
+ window.location.assign(`/board/${board}`);
+ }
+ else {
+ alert(`An Error has Accured: ${r.status} ${t}`);
}
- else alert('An Error has Accured');
})
}
form.append('board', board);
- form.append('iphash', iphash);
if(tid) form.append('tid', tid);
let image = document.getElementById("image").files[0];