include credentials on fetch calls
This commit is contained in:
parent
4e039fb583
commit
c649dbbcc2
3 changed files with 11 additions and 4 deletions
|
|
@ -3,7 +3,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
const form = document.getElementById('texts-form');
|
||||
|
||||
async function loadTexts() {
|
||||
const res = await fetch('/api/texts');
|
||||
const res = await fetch('/api/texts', {
|
||||
credentials: 'same-origin',
|
||||
});
|
||||
const texts = await res.json();
|
||||
textsList.innerHTML = texts.map(text =>
|
||||
'<li><a href=/admin/texts/'
|
||||
|
|
@ -18,6 +20,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
const formData = new FormData(form);
|
||||
const res = await fetch('/api/texts', {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
body: formData,
|
||||
});
|
||||
if (res.ok) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue