Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

Update API

Katose216d468481e
diff --git a/docs/en/api.md b/docs/en/api.md
index 5e99656e..893ea228 100644
--- a/docs/en/api.md
+++ b/docs/en/api.md
@@ -5,6 +5,22 @@ sidebar: false
<script setup lang="ts">
import { useData } from 'vitepress';
+import { ref, onMounted, onBeforeUnmount } from 'vue';
+
+// Create a key ref to force re-render of the elements-api component
+const componentKey = ref(0);
+
+// Use a native event listener to intercept hash changes
+const handleHashChange = () => {
+ componentKey.value++;
+};
+
+onMounted(() => {
+ window.addEventListener('hashchange', handleHashChange);
+});
+onBeforeUnmount(() => {
+ window.removeEventListener('hashchange', handleHashChange);
+});
const elementScript = document.createElement('script');
elementScript.src = 'https://unpkg.com/@stoplight/elements/web-components.min.js';
@@ -24,13 +40,17 @@ if (isDark.value) {
<style>
.TryItPanel {
- display: none;
+ display: none;
}
</style>
-<elements-api
-apiDescriptionUrl="https://cdn.jsdelivr.net/gh/sysadminsmedia/homebox@main/docs/docs/api/openapi-2.0.json"
-layout="responsive"
-hideSchemas="true"
-:data-theme="theme"
-/>
+<client-only>
+ <elements-api
+ :key="componentKey"
+ apiDescriptionUrl="https://cdn.jsdelivr.net/gh/sysadminsmedia/homebox@main/docs/docs/api/openapi-2.0.json"
+ router="hash"
+ layout="responsive"
+ hideSchemas="true"
+ :data-theme="theme"
+ />
+</client-only>