refactor: use real urls instead of pretty

This commit is contained in:
grandeljay 2023-09-27 09:39:45 +02:00
parent 5943c49deb
commit dd862cf84c
6 changed files with 22 additions and 22 deletions

View file

@ -2,7 +2,7 @@ $(function() {
/**
* Statistics
*/
fetch('/api/statistics/all', {
fetch('/index.php?page=api&module=statistics&table=all', {
method: 'GET'
})
.then(handleFetchError)
@ -56,7 +56,7 @@ $(function() {
/**
* News
*/
fetch('/api/blog', {
fetch('/index.php?page=api&module=blog', {
method: 'GET'
})
.then(handleFetchError)

View file

@ -20,7 +20,7 @@ window.addEventListener("load", (event) => {
data.append('page', wishthis.$_GET.page);
/** Save page preview */
fetch('/api/save-preview', {
fetch('/index.php?page=api&module=save-preview', {
method : 'POST',
body : data
})

View file

@ -9,7 +9,7 @@ $(function() {
form.addClass('loading');
fetch('/api/database-test', {
fetch('/index.php?page=api&module=database-test', {
method : 'POST',
body : formDatabase
})

View file

@ -93,7 +93,7 @@ $(function () {
}
);
fetch('/?' + get_wish, { method: 'GET' })
fetch('/index.php?' + get_wish, { method: 'GET' })
.then(handleFetchError)
.then(handleFetchResponse)
.then(function(response) {
@ -147,7 +147,7 @@ $(function () {
$(this).addClass('disabled loading');
fetch('/api/wishes', mark_as_fulfilled)
fetch('/index.php?page=api&module=wishes', mark_as_fulfilled)
.then(handleFetchError)
.then(handleFetchResponse)
.then(function(response) {
@ -177,7 +177,7 @@ $(function () {
$(this).addClass('disabled loading');
fetch('/api/wishes', mark_as_fulfilled)
fetch('/index.php?page=api&module=wishes', mark_as_fulfilled)
.then(handleFetchError)
.then(handleFetchResponse)
.then(function(response) {
@ -277,7 +277,7 @@ $(function () {
)
);
fetch('/api/wishes', {
fetch('/index.php?page=api&module=wishes', {
'method' : 'POST',
'body' : wish_data,
})
@ -335,7 +335,7 @@ $(function () {
'wish_id' : wish_local.id
});
fetch('/api/wishes', {
fetch('/index.php?page=api&module=wishes', {
'method' : 'DELETE',
'body' : wish_delete,
})

View file

@ -53,7 +53,7 @@ $(function () {
if (wishlist_id) {
/** Get wishlist */
fetch('/api/wishlists/' + wishlist_id, { method: 'GET' })
fetch('/index.php?page=api&module=wishlists&id=' + wishlist_id, { method: 'GET' })
.then(handleFetchError)
.then(handleFetchResponse)
.then(function(response) {
@ -110,7 +110,7 @@ $(function () {
'wish_priority' : -1,
}
);
fetch('/?' + get_wishes, { method: 'GET' })
fetch('/index.php?' + get_wishes, { method: 'GET' })
.then(handleFetchError)
.then(handleFetchResponse)
.then(function(response) {
@ -201,7 +201,7 @@ $(function () {
var formData = new URLSearchParams(new FormData(formRename[0]));
formData.append('wishlist_id', wishthis.$_GET.id);
fetch('/api/wishlists', {
fetch('/index.php?page=api&module=wishlists', {
method : 'PUT',
body : formData,
})
@ -283,7 +283,7 @@ $(function () {
'wishlist_id' : wishlist_id,
}
);
fetch('/api/wishlists', {
fetch('/index.php?page=api&module=wishlists', {
'method' : 'DELETE',
'body' : delete_wishlist,
})
@ -390,7 +390,7 @@ $(function () {
var formData = new URLSearchParams(new FormData(formWishlistCreate[0]));
fetch('/api/wishlists', {
fetch('/index.php?page=api&module=wishlists', {
method : 'POST',
body : formData
})
@ -454,7 +454,7 @@ $(function () {
}
);
fetch('/?' + params_url, {
fetch('/index.php?' + params_url, {
method: 'GET'
})
.then(handleFetchError)
@ -491,7 +491,7 @@ $(function () {
}
);
fetch('/?page=api&module=wishes', {
fetch('/index.php?page=api&module=wishes', {
method : 'PUT',
body : formData
})
@ -527,7 +527,7 @@ $(function () {
var formData = new URLSearchParams(new FormData(formAddOrEdit[0]));
formData.append('wishlist_id', wishthis.$_GET.id);
fetch('/api/wishes', {
fetch('/index.php?page=api&module=wishes', {
'method' : 'POST',
'body' : formData,
})
@ -555,7 +555,7 @@ $(function () {
* Update URL
*/
function updateURL() {
fetch('/api/url/' + window.btoa('/?' + urlParams.toString()), { method: 'GET' })
fetch('/index.php?page=api&module=url&url=' + window.btoa('/?' + urlParams.toString()), { method: 'GET' })
.then(handleFetchError)
.then(handleFetchResponse)
.then(function(response) {

View file

@ -38,7 +38,7 @@ $(function() {
if (!wishlist && wishthis.$_GET.hash) {
var wishlistId = $('.wishlist-cards[data-wishlist]').attr('data-wishlist');
fetch('/api/wishlists/' + wishlistId, { method: 'GET' })
fetch('/index.php?page=api&module=wishlists&id=' + wishlistId, { method: 'GET' })
.then(handleFetchError)
.then(handleFetchResponse)
.then(function(response) {
@ -104,7 +104,7 @@ $(function() {
}
);
fetch('/api/wishlists-saved', {
fetch('/index.php?page=api&module=wishlists-saved', {
method : 'POST',
body : formData
})
@ -127,7 +127,7 @@ $(function() {
});
/** Determine if list is saved */
fetch('/api/wishlists-saved', {
fetch('/index.php?page=api&module=wishlists-saved', {
method : 'GET',
})
.then(handleFetchError)
@ -175,7 +175,7 @@ $(function() {
buttonRequest.addClass('disabled loading');
fetch('/api/wishlists', {
fetch('/index.php?page=api&module=wishlists', {
method : 'POST',
body : formData
})