tenebrous-sheets/static/scripts/src/api.ts

16 lines
552 B
TypeScript
Raw Normal View History

import { UpdateSkillValueRequest } from "../_proto/cofd_api_pb";
const PROTOBUF_CONTENT_TYPE = { 'Content-Type': 'application/x-protobuf' };
export async function updateSkillValue(params: UpdateSkillValueRequest) {
let resp = await fetch('/api/rpc/cofd/update_skill_value', {
method: 'POST',
headers: { ...PROTOBUF_CONTENT_TYPE },
body: params.serializeBinary()
}).then(async resp => {
console.log("resp is", await resp.text());
}).catch(async err => {
console.log("err is", err.text());
});
}