Better error handling for incrementing watched count on Anime list

This commit is contained in:
Timothy Warren 2018-08-09 11:31:15 -04:00
parent 3d51a81347
commit 6f7d94641e
4 changed files with 743 additions and 451 deletions

View File

@ -39,7 +39,16 @@
data, data,
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
success: () => { success: (res) => {
const resData = JSON.parse(res);
if (resData.errors) {
_.hide(_.$('#loading-shadow')[ 0 ]);
_.showMessage('error', `Failed to update ${title}. `);
_.scrollToTop();
return;
}
if (data.data.status === 'completed') { if (data.data.status === 'completed') {
_.hide(parentSel); _.hide(parentSel);
} }

View File

@ -273,7 +273,7 @@ var AnimeClient = (function(w) {
responseText = request.responseText; responseText = request.responseText;
} }
if (request.status > 400) { if (request.status > 299) {
config.error.call(null, request.status, responseText, request.response); config.error.call(null, request.status, responseText, request.response);
} else { } else {
config.success.call(null, responseText, request.status); config.success.call(null, responseText, request.status);

View File

@ -4,10 +4,10 @@
"watch": "watch 'npm run build' --filter=./cssfilter.js" "watch": "watch 'npm run build' --filter=./cssfilter.js"
}, },
"devDependencies": { "devDependencies": {
"cssnano": "^3.10.0", "cssnano": "^4.0.5",
"postcss-cachify": "^1.3.1", "postcss-cachify": "^1.3.1",
"postcss-cssnext": "^3.0.0", "postcss-cssnext": "^3.0.0",
"postcss-import": "^10.0.0", "postcss-import": "^12.0.0",
"watch": "^1.0.2" "watch": "^1.0.2"
} }
} }

File diff suppressed because it is too large Load Diff