fix: include cookies for fetch request
This commit is contained in:
parent
229d04eb07
commit
0a667b312d
6 changed files with 75 additions and 34 deletions
|
@ -3,7 +3,8 @@ $(function() {
|
|||
* Statistics
|
||||
*/
|
||||
fetch('/index.php?page=api&module=statistics&table=all', {
|
||||
method: 'GET'
|
||||
method : 'GET',
|
||||
credentials : 'include',
|
||||
})
|
||||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
|
@ -57,7 +58,8 @@ $(function() {
|
|||
* News
|
||||
*/
|
||||
fetch('/index.php?page=api&module=blog', {
|
||||
method: 'GET'
|
||||
method : 'GET',
|
||||
credentials : 'include',
|
||||
})
|
||||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
|
|
|
@ -22,7 +22,8 @@ window.addEventListener("load", (event) => {
|
|||
/** Save page preview */
|
||||
fetch('/index.php?page=api&module=save-preview', {
|
||||
method : 'POST',
|
||||
body : data
|
||||
credentials : 'include',
|
||||
body : data,
|
||||
})
|
||||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
|
|
|
@ -11,7 +11,8 @@ $(function() {
|
|||
|
||||
fetch('/index.php?page=api&module=database-test', {
|
||||
method : 'POST',
|
||||
body : formDatabase
|
||||
credentials : 'include',
|
||||
body : formDatabase,
|
||||
})
|
||||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
|
|
|
@ -93,7 +93,13 @@ $(function () {
|
|||
}
|
||||
);
|
||||
|
||||
fetch('/index.php?' + get_wish, { method: 'GET' })
|
||||
fetch(
|
||||
'/index.php?' + get_wish,
|
||||
{
|
||||
method : 'GET',
|
||||
credentials : 'include',
|
||||
}
|
||||
)
|
||||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
.then(function(response) {
|
||||
|
@ -110,7 +116,13 @@ $(function () {
|
|||
var wish_image_ext = wish_image.split('.').pop();
|
||||
|
||||
if ('svg' === wish_image_ext) {
|
||||
fetch(wish_image, { method: 'GET' })
|
||||
fetch(
|
||||
wish_image,
|
||||
{
|
||||
method : 'GET',
|
||||
credentials : 'include',
|
||||
}
|
||||
)
|
||||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
.then(function(response) {
|
||||
|
@ -139,6 +151,7 @@ $(function () {
|
|||
const modal_wish_details = $(this).closest('.ui.modal');
|
||||
const mark_as_fulfilled = {
|
||||
'method' : 'PUT',
|
||||
'credentials' : 'include',
|
||||
'body' : new URLSearchParams({
|
||||
'wish_id' : wish.id,
|
||||
'wish_status' : wishthis.wish.status.fulfilled,
|
||||
|
@ -169,6 +182,7 @@ $(function () {
|
|||
const modal_wish_details = $(this).closest('.ui.modal');
|
||||
const mark_as_fulfilled = {
|
||||
'method' : 'PUT',
|
||||
'credentials' : 'include',
|
||||
'body' : new URLSearchParams({
|
||||
'wish_id' : wish.id,
|
||||
'wish_status' : wishthis.wish.status.unavailable,
|
||||
|
@ -279,6 +293,7 @@ $(function () {
|
|||
|
||||
fetch('/index.php?page=api&module=wishes', {
|
||||
'method' : 'POST',
|
||||
'credentials' : 'include',
|
||||
'body' : wish_data,
|
||||
})
|
||||
.then(handleFetchError)
|
||||
|
@ -337,6 +352,7 @@ $(function () {
|
|||
|
||||
fetch('/index.php?page=api&module=wishes', {
|
||||
'method' : 'DELETE',
|
||||
'credentials' : 'include',
|
||||
'body' : wish_delete,
|
||||
})
|
||||
.then(handleFetchError)
|
||||
|
|
|
@ -143,6 +143,7 @@ $(function () {
|
|||
|
||||
fetch('/index.php?page=api&module=wishlists', {
|
||||
method : 'PUT',
|
||||
credentials : 'include',
|
||||
body : formData,
|
||||
})
|
||||
.then(handleFetchError)
|
||||
|
@ -225,6 +226,7 @@ $(function () {
|
|||
);
|
||||
fetch('/index.php?page=api&module=wishlists', {
|
||||
'method' : 'DELETE',
|
||||
'credentials' : 'include',
|
||||
'body' : delete_wishlist,
|
||||
})
|
||||
.then(handleFetchError)
|
||||
|
@ -332,6 +334,7 @@ $(function () {
|
|||
|
||||
fetch('/index.php?page=api&module=wishlists', {
|
||||
method : 'POST',
|
||||
credentials : 'include',
|
||||
body : formData
|
||||
})
|
||||
.then(handleFetchError)
|
||||
|
@ -395,7 +398,8 @@ $(function () {
|
|||
);
|
||||
|
||||
fetch('/index.php?' + params_url, {
|
||||
method: 'GET'
|
||||
method : 'GET',
|
||||
credentials : 'include',
|
||||
})
|
||||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
|
@ -433,6 +437,7 @@ $(function () {
|
|||
|
||||
fetch('/index.php?page=api&module=wishes', {
|
||||
method : 'PUT',
|
||||
credentials : 'include',
|
||||
body : formData
|
||||
})
|
||||
.then(handleFetchError)
|
||||
|
@ -469,6 +474,7 @@ $(function () {
|
|||
|
||||
fetch('/index.php?page=api&module=wishes', {
|
||||
'method' : 'POST',
|
||||
'credentials' : 'include',
|
||||
'body' : formData,
|
||||
})
|
||||
.then(handleFetchError)
|
||||
|
@ -495,7 +501,13 @@ $(function () {
|
|||
* Update URL
|
||||
*/
|
||||
function updateURL() {
|
||||
fetch('/index.php?page=api&module=url&url=' + window.btoa('/?' + urlParams.toString()), { method: 'GET' })
|
||||
fetch(
|
||||
'/index.php?page=api&module=url&url=' + window.btoa('/?' + urlParams.toString()),
|
||||
{
|
||||
method : 'GET',
|
||||
credentials : 'include',
|
||||
}
|
||||
)
|
||||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
.then(function(response) {
|
||||
|
|
|
@ -38,7 +38,13 @@ $(function() {
|
|||
if (!wishlist && wishthis.$_GET.hash) {
|
||||
var wishlistId = $('.wishlist-cards[data-wishlist]').attr('data-wishlist');
|
||||
|
||||
fetch('/index.php?page=api&module=wishlists&id=' + wishlistId, { method: 'GET' })
|
||||
fetch(
|
||||
'/index.php?page=api&module=wishlists&id=' + wishlistId,
|
||||
{
|
||||
method : 'GET',
|
||||
credentials : 'include',
|
||||
}
|
||||
)
|
||||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
.then(function(response) {
|
||||
|
@ -106,6 +112,7 @@ $(function() {
|
|||
|
||||
fetch('/index.php?page=api&module=wishlists-saved', {
|
||||
method : 'POST',
|
||||
credentials : 'include',
|
||||
body : formData
|
||||
})
|
||||
.then(handleFetchError)
|
||||
|
@ -129,6 +136,7 @@ $(function() {
|
|||
/** Determine if list is saved */
|
||||
fetch('/index.php?page=api&module=wishlists-saved', {
|
||||
method : 'GET',
|
||||
credentials : 'include',
|
||||
})
|
||||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
|
@ -177,6 +185,7 @@ $(function() {
|
|||
|
||||
fetch('/index.php?page=api&module=wishlists', {
|
||||
method : 'POST',
|
||||
credentials : 'include',
|
||||
body : formData
|
||||
})
|
||||
.then(handleFetchError)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue