mirror of
https://github.com/sst/opencode.git
synced 2025-07-07 16:14:59 +00:00
fix /unshare
This commit is contained in:
parent
fce59db94a
commit
ed4f862b49
2 changed files with 6 additions and 6 deletions
|
@ -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) {
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue