1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
interface UpdateValArgs {
token: string;
code: string;
name?: string;
}
export function updateValByName({ token, code, name }: UpdateValArgs): Promise<any> {
const body: Record<string, unknown> = {
token,
code,
name,
};
return fetchJSON("https://api.val.town/v1/vals", {
headers: {
Authorization: `Bearer ${token}`,
},
method: "PUT",
body: JSON.stringify(body),
});
}