import { id as moduleId } from "../../module.json"; import { CharacterManagerClient } from "../../proto/character.client"; import { GetCharacterRequest } from '../../proto/character' import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport' export class CharacterArchiver extends Application { readonly characterId: String; readonly character: Actor | undefined; readonly client = new CharacterManagerClient( new GrpcWebFetchTransport({ baseUrl: 'http://localhost/api', format: 'binary', }), ); thingy: any; constructor(characterId: string) { super() this.characterId = characterId; this.character = (game as Game).actors!.get(characterId); } static override get defaultOptions() { const options = super.defaultOptions; options.id = "character-archiver"; options.template = `modules/${moduleId}/templates/CharacterArchiver.hbs`; options.width = 500; options.height = 270; options.tabs = []; return options; } override getData() { return { potato: "potato tato po tato", reads: this.thingy }; } override activateListeners(html: JQuery): void { console.log("activating listeners"); super.activateListeners(html); html .find("button.archive-button") .on("click", this._archiveButton.bind(this)); } private async _archiveButton() { console.log("Potato"); let request = GetCharacterRequest.fromJson({ }) console.log("Potato"); await this.client.getCharacter(request).then((res: any) => { console.log(res) this.thingy = res.response; console.log(res); this.render(true); }) } }