change modal on error

This commit is contained in:
Mateusz Gruszczyński
2026-08-05 10:38:17 +02:00
parent 73286d921b
commit c4d04adb40
5 changed files with 25 additions and 8 deletions
+8
View File
@@ -7,6 +7,14 @@
* See LICENSE file in repository root for details.
*/
const RESOURCE_ACCESS_ERROR_PATTERN = /(?:invalid password|password required|authentication required|access expired or revoked)/i;
export function isResourceAccessError(error) {
const status = Number(error?.status);
const message = typeof error === "string" ? error : error?.message;
return status === 401 || RESOURCE_ACCESS_ERROR_PATTERN.test(String(message || ""));
}
export function safeAppUrl(value, fallback = "/") {
try {
const url = new URL(String(value || ""), location.origin);