fix: call EnsureNamespace on login to auto-create k8s namespace

doLogin() now calls POST /v1/namespaces/{ns}/ensure before apiListDevices().
Prevents namespace not found error when user logs in for the first time
with a new token (test mode or real JWT).
Image: v0.1.62
This commit is contained in:
Naeel
2026-04-05 11:06:27 +03:00
parent 354fded5b9
commit 11bc86d2c9
+4
View File
@@ -604,6 +604,10 @@ async function doLogin() {
S.token = tok; S.token = tok;
try { try {
// Создаём namespace если не существует — идемпотентный вызов.
// Terraform-провайдер делает это в Configure(), консоль — при первом логине.
// Без этого шага создание устройства упадёт с "namespace not found".
await apiCall('POST', `/v1/namespaces/${S.ns}/ensure`, {});
await apiListDevices(); // проверяем что токен валиден и API доступен await apiListDevices(); // проверяем что токен валиден и API доступен
saveSettings(); saveSettings();
nav('devices'); nav('devices');