diff options
| author | Shulhan <ms@kilabit.info> | 2024-02-19 13:56:42 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-02-19 13:56:42 +0700 |
| commit | 99999635f67931e1a6deb608f13b2dc2ecd9df73 (patch) | |
| tree | 896ada622df0759e067390a84e62b856600514c8 /_www/nav_links.ts | |
| parent | 08de328c6bfa5719bdd7003e3064668fd4e62f27 (diff) | |
| download | gorankusu-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/nav_links.ts')
| -rw-r--r-- | _www/nav_links.ts | 3 |
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); |
