diff --git a/src/templates/CharacterArchiver.hbs b/src/templates/CharacterArchiver.hbs index b67f9b9..bb1a31d 100644 --- a/src/templates/CharacterArchiver.hbs +++ b/src/templates/CharacterArchiver.hbs @@ -1,7 +1,7 @@
Hello There {{this.potato}} - +
Avaiable Versions Go Here diff --git a/src/ts/apps/CharacterArchiver.ts b/src/ts/apps/CharacterArchiver.ts index 2d219ef..2b5c5c4 100644 --- a/src/ts/apps/CharacterArchiver.ts +++ b/src/ts/apps/CharacterArchiver.ts @@ -1,6 +1,6 @@ import { id as moduleId } from "../../module.json"; import { CharacterManagerClient } from "../../proto/character.client"; -import { GetCharacterRequest } from '../../proto/character' +import { Character, CreateCharacterRequest } from '../../proto/character' import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport' @@ -16,7 +16,11 @@ export class CharacterArchiver extends Application { }), ); - thingy: any; + data = { + potato: "po tato potato", + reads: {}, + handle: "default" + } constructor(characterId: string) { super() @@ -35,10 +39,7 @@ export class CharacterArchiver extends Application { } override getData() { - return { - potato: "potato tato po tato", - reads: this.thingy - }; + return this.data; } @@ -47,21 +48,43 @@ export class CharacterArchiver extends Application { super.activateListeners(html); html .find("button.archive-button") - .on("click", this._archiveButton.bind(this)); + .on("click", this.archiveButton.bind(this)); + + console.log(html.find(".character-handle")); + + html + .find(".character-handle") + .on("change", this.handleChange.bind(this)); } - private async _archiveButton() { + 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); - }) + + let characterMsg: Character = Character.fromJson({ + playerName: "iamBadgers", + characterName: this.character!.name, + characterAlias: [], + version: "", + sourceTable: "", + json: JSON.stringify(this.character!.toJSON()) + + }); + + let request: CreateCharacterRequest = { + characterData: characterMsg + }; + + console.log("HERE: " + JSON.stringify(request)); + + this.client.createCharacter(request); } -} \ No newline at end of file + private async handleChange(e: Event) { + console.log(e.target); + const target = e.target as HTMLTextAreaElement; + this.data.handle = target.value; + console.log(this.data.handle); + } + +}