Fix sending "undefined" to sync favorites

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2023-07-14 16:41:58 +02:00
parent d1019373ce
commit d4b3f7844c
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -3806,14 +3806,22 @@ AJAX.registerOnload('functions.js', function () {
// Sync favorite tables from localStorage to pmadb.
if ($('#sync_favorite_tables').length) {
var favoriteTables = '';
if (isStorageSupported('localStorage')
&& typeof window.localStorage.favoriteTables !== 'undefined'
&& window.localStorage.favoriteTables !== 'undefined') {
favoriteTables = window.localStorage.favoriteTables;
if (favoriteTables === 'undefined') {
// Do not send an invalid value
return;
}
}
$.ajax({
url: $('#sync_favorite_tables').attr('href'),
cache: false,
type: 'POST',
data: {
'favoriteTables': (isStorageSupported('localStorage') && typeof window.localStorage.favoriteTables !== 'undefined')
? window.localStorage.favoriteTables
: '',
'favoriteTables': favoriteTables,
'server': CommonParams.get('server'),
'no_debug': true
},