fix /unshare

This commit is contained in:
Dax Raad 2025-07-03 15:33:55 -04:00
parent fce59db94a
commit ed4f862b49
2 changed files with 6 additions and 6 deletions

View file

@ -185,11 +185,14 @@ export namespace Session {
}
export async function unshare(id: string) {
const share = await getShare(id)
if (!share) return
console.log("share", share)
await Storage.remove("session/share/" + id)
await update(id, (draft) => {
draft.share = undefined
})
await Share.remove(id)
await Share.remove(id, share.secret)
}
export async function update(id: string, editor: (session: Info) => void) {

View file

@ -66,13 +66,10 @@ export namespace Share {
.then((x) => x as { url: string; secret: string })
}
export async function remove(id: string) {
const share = await Session.getShare(id).catch(() => {})
if (!share) return
const { secret } = share
export async function remove(sessionID: string, secret: string) {
return fetch(`${URL}/share_delete`, {
method: "POST",
body: JSON.stringify({ id, secret }),
body: JSON.stringify({ sessionID, secret }),
}).then((x) => x.json())
}
}