fixed bugs introduced by switching from titles as ids to separate ids

This commit is contained in:
2025-09-12 00:59:19 +02:00
parent 667052e3c4
commit f13da92b48
6 changed files with 14 additions and 12 deletions

View File

@@ -11,7 +11,7 @@
import TagList from '../tags/TagList.svelte';
let error = $state(null);
let { id, version } = $props();
let { key, version } = $props();
let page = $state(null);
let router = useTinyRouter();
let members = $state({});
@@ -64,7 +64,7 @@
}
async function loadPage(){
let path = `wiki/page/${id}`;
let path = `wiki/page/${key}`;
if (version) path += `/version/${version}`;
const url = api(path);
const res = await fetch(url,{credentials:'include'});
@@ -79,7 +79,7 @@
}
async function patch(data){
const url = api(`wiki/page/${id}`);
const url = api(`wiki/page/${page.id}`);
const res = await fetch(url,{
credentials:'include',
method:'PATCH',
@@ -103,10 +103,10 @@
<span class="version">{t('version')}</span>
{#each page.versions as v}
<span class="version">
<a href={`/wiki/${id}/version/${v}`} {onclick} class={page.version == v?'selected':''}>{v}</a> &nbsp;
<a href={`/wiki/${key}/version/${v}`} {onclick} class={page.version == v?'selected':''}>{v}</a> &nbsp;
</span>
{/each}
<h2>{id}</h2>
<h2>{page.title}</h2>
{#if page.version != page.versions[0]}
<span class="warn">{t('not_recent_version')}</span>
{/if}
@@ -132,9 +132,9 @@
</tbody>
</table>
{/if}
<TagList module="wiki" {id} user_list={Object.keys(page.members).map(id => +id)} />
<TagList module="wiki" id={page.id} user_list={Object.keys(page.members).map(id => +id)} />
<div class="notes">
<h3>{t('notes')}</h3>
<Notes module="wiki" entity_id={id} />
<Notes module="wiki" entity_id={page.id} />
</div>
{/if}