MCPcopy Index your code
hub / github.com/wandb/openui / share

Function share

frontend/src/api/openui.ts:19–36  ·  view source on GitHub ↗
(id: string, item: ItemWrapper, versionIdx: number)

Source from the content-addressed store, hash-verified

17const API_HOST = (import.meta.env.VITE_API_HOST ?? '/v1') as string
18
19export async function share(id: string, item: ItemWrapper, versionIdx: number) {
20 const r = await fetch(`${API_HOST}/share/${id}`, {
21 method: 'POST',
22 headers: {
23 'Content-Type': 'application/json'
24 },
25 body: JSON.stringify({
26 prompt: item.prompt(versionIdx),
27 html: item.pureHTML(versionIdx),
28 name: item.name,
29 emoji: item.emoji
30 })
31 })
32 if (r.status !== 201) {
33 const body = (await r.json()) as ErrorBody
34 throw new Error(body.error.message)
35 }
36}
37
38export async function voteRequest(
39 vote: boolean,

Callers 1

ShareDialogFunction · 0.90

Calls 2

promptMethod · 0.80
pureHTMLMethod · 0.80

Tested by

no test coverage detected