aboutsummaryrefslogtreecommitdiff
path: root/_www
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-02-19 13:56:42 +0700
committerShulhan <ms@kilabit.info>2024-02-19 13:56:42 +0700
commit99999635f67931e1a6deb608f13b2dc2ecd9df73 (patch)
tree896ada622df0759e067390a84e62b856600514c8 /_www
parent08de328c6bfa5719bdd7003e3064668fd4e62f27 (diff)
downloadgorankusu-99999635f67931e1a6deb608f13b2dc2ecd9df73.tar.xz
all: fix null navigation links
If the navLinks fields is empty, the HTTP API will return "null" and make the rendering error. This changes fix this issue by allocating the slice navLinks with one capabilities to make JSON always return "[]" if its empty.
Diffstat (limited to '_www')
-rw-r--r--_www/nav_links.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/_www/nav_links.ts b/_www/nav_links.ts
index dbddb2f..f577607 100644
--- a/_www/nav_links.ts
+++ b/_www/nav_links.ts
@@ -38,6 +38,9 @@ export class NavLinks {
}
generateNav() {
+ if (!this.navs) {
+ return;
+ }
this.navs.forEach((nav: NavLinkInterface) => {
const el = document.createElement("div");
el.classList.add(CLASS_NAV_LINK);