hinzufügen von wörtern
This commit is contained in:
17
index.js
17
index.js
@ -9,3 +9,20 @@ function re_direct () {
|
||||
window.location.href = `/${encodedSession}/${encodedUser}`;
|
||||
|
||||
}
|
||||
|
||||
async function addWord() {
|
||||
const word = document.getElementById('word').value.trim();
|
||||
const imposterWord = document.getElementById('imposterWord').value.trim();
|
||||
|
||||
const data = {
|
||||
word: word,
|
||||
imposterWord: imposterWord,
|
||||
}
|
||||
const res = await fetch (`/api/words/add`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user