removed legacy 404 check and preserved collections sort order within each type group
This commit is contained in:
@@ -38,16 +38,11 @@ PocketBase.prototype.error = function(err, notify = true, defaultMsg = "") {
|
||||
|
||||
const statusCode = (err?.status << 0) || 400;
|
||||
const responseData = err?.data || {};
|
||||
const msg = responseData.message || err.message || defaultMsg;
|
||||
|
||||
// add toast error notification
|
||||
if (
|
||||
notify && // notifications are enabled
|
||||
statusCode !== 404 // is not 404
|
||||
) {
|
||||
let msg = responseData.message || err.message || defaultMsg;
|
||||
if (msg) {
|
||||
addErrorToast(msg);
|
||||
}
|
||||
if (notify && msg) {
|
||||
addErrorToast(msg);
|
||||
}
|
||||
|
||||
// populate form field errors
|
||||
|
||||
@@ -1229,7 +1229,7 @@ export default class CommonHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups and sorts collections array by type (auth, base, view).
|
||||
* Groups and sorts collections array by type (auth, base, view) and name.
|
||||
*
|
||||
* @param {Array} collections
|
||||
* @return {Array}
|
||||
@@ -1249,7 +1249,17 @@ export default class CommonHelper {
|
||||
}
|
||||
}
|
||||
|
||||
return [].concat(auth, base, view);
|
||||
function sortNames(a, b) {
|
||||
if (a.name > b.name) {
|
||||
return 1
|
||||
}
|
||||
if (a.name < b.name) {
|
||||
return -1
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return [].concat(auth.sort(sortNames), base.sort(sortNames), view.sort(sortNames));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user