Watchlist eye: confirm before removing (the standard yes/no dialog)
The eye is small/easy to mis-click and the card vanishes on the watchlist page, so removal now goes through the shared showConfirmDialog (core.js) — 'Remove "<title>" from your watchlist?' — before un-following. Adding stays one-click instant. Cancelling re-enables the button with no change.
This commit is contained in:
parent
d49eb967a4
commit
b344303f75
1 changed files with 23 additions and 6 deletions
|
|
@ -73,12 +73,29 @@
|
||||||
b.disabled = true;
|
b.disabled = true;
|
||||||
var done = function () { b.disabled = false; };
|
var done = function () { b.disabled = false; };
|
||||||
if (on) {
|
if (on) {
|
||||||
fetch('/api/video/watchlist/remove', {
|
// Removal is confirmed (the standard music yes/no dialog) — the eye is
|
||||||
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
// small + easy to mis-click and the card vanishes on the watchlist
|
||||||
body: JSON.stringify({ kind: kind, tmdb_id: Number(id) })
|
// page. Adding stays instant.
|
||||||
}).then(function (r) { return r.json(); }).then(function (d) {
|
var name = b.getAttribute('data-vwl-title') || '';
|
||||||
if (d && d.success) { syncAll(kind, id, false); toast('Removed from watchlist', 'info'); }
|
var label = name ? '“' + name + '”' : (kind === 'person' ? 'this person' : 'this show');
|
||||||
}).catch(function () { toast('Watchlist update failed', 'error'); }).then(done);
|
var doRemove = function () {
|
||||||
|
fetch('/api/video/watchlist/remove', {
|
||||||
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ kind: kind, tmdb_id: Number(id) })
|
||||||
|
}).then(function (r) { return r.json(); }).then(function (d) {
|
||||||
|
if (d && d.success) { syncAll(kind, id, false); toast('Removed from watchlist', 'info'); }
|
||||||
|
}).catch(function () { toast('Watchlist update failed', 'error'); }).then(done);
|
||||||
|
};
|
||||||
|
var confirm = (typeof showConfirmDialog === 'function')
|
||||||
|
? showConfirmDialog({
|
||||||
|
title: 'Remove from Watchlist',
|
||||||
|
message: 'Remove ' + label + ' from your watchlist?',
|
||||||
|
confirmText: 'Remove', cancelText: 'Cancel', destructive: true })
|
||||||
|
: Promise.resolve(true);
|
||||||
|
Promise.resolve(confirm).then(function (ok) {
|
||||||
|
if (ok) doRemove();
|
||||||
|
else done(); // cancelled — re-enable, no change
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
var body = {
|
var body = {
|
||||||
kind: kind, tmdb_id: Number(id),
|
kind: kind, tmdb_id: Number(id),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue