From b9db505978f971974bb71bbc40c8efd4b23291e1 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 28 Jan 2024 18:24:45 +0200 Subject: [PATCH] frontend/devices: Fix unused retry API error codes --- qtoggleserver/frontend/js/devices/add-device-form.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qtoggleserver/frontend/js/devices/add-device-form.js b/qtoggleserver/frontend/js/devices/add-device-form.js index e2ff3c5..e7c7d05 100644 --- a/qtoggleserver/frontend/js/devices/add-device-form.js +++ b/qtoggleserver/frontend/js/devices/add-device-form.js @@ -90,7 +90,8 @@ class AddDeviceForm extends PageForm { }).catch(function (error) { /* Retry with /api path, which should be a default location for qToggleServer implementations */ - if (error instanceof BaseAPI.APIError && error.status === 404 && url.path === '/') { + if (error instanceof BaseAPI.APIError && url.path === '/' && + (error.status === 404 || RETRY_API_ERROR_CODES.indexOf(error.code) >= 0)) { logger.debug('retrying with /api suffix') url.path = '/api' data.url = url.toString()