ngx-xtroedge-cms 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.global.js +2 -2
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1821,10 +1821,17 @@ var XtroedgeCMS = class _XtroedgeCMS {
|
|
|
1821
1821
|
headers: { "Content-Type": "application/json" },
|
|
1822
1822
|
body: JSON.stringify({ username: email, password })
|
|
1823
1823
|
});
|
|
1824
|
-
|
|
1825
|
-
|
|
1824
|
+
let data = null;
|
|
1825
|
+
try {
|
|
1826
|
+
data = await res.json();
|
|
1827
|
+
} catch {
|
|
1828
|
+
}
|
|
1829
|
+
if (!res.ok) {
|
|
1830
|
+
const apiMsg = data?.message || data?.error || null;
|
|
1831
|
+
throw new Error(apiMsg || `HTTP ${res.status}`);
|
|
1832
|
+
}
|
|
1826
1833
|
const token = data?.token || data?.authToken || data?.auth_token || data?.data?.token;
|
|
1827
|
-
if (!token) throw new Error("
|
|
1834
|
+
if (!token) throw new Error("Login successful but no token returned.");
|
|
1828
1835
|
localStorage.setItem("builder_token", token);
|
|
1829
1836
|
this.hideLoginModal();
|
|
1830
1837
|
this.editMode = true;
|
|
@@ -1833,10 +1840,10 @@ var XtroedgeCMS = class _XtroedgeCMS {
|
|
|
1833
1840
|
this.applyEditMode(true);
|
|
1834
1841
|
this.updateUI();
|
|
1835
1842
|
this.loadPageContent("draft");
|
|
1836
|
-
} catch {
|
|
1843
|
+
} catch (err) {
|
|
1837
1844
|
btn.disabled = false;
|
|
1838
1845
|
btn.textContent = "Sign In";
|
|
1839
|
-
errorEl.textContent = "
|
|
1846
|
+
errorEl.textContent = err?.message || "Login failed. Please try again.";
|
|
1840
1847
|
errorEl.classList.add("visible");
|
|
1841
1848
|
}
|
|
1842
1849
|
}
|