preview view model

This commit is contained in:
Bruno Windels
2020-11-27 21:28:54 +01:00
parent 7a6efbcf90
commit ead94695f1
7 changed files with 107 additions and 16 deletions
+7 -13
View File
@@ -1,16 +1,10 @@
import {xhrRequest} from "./utils/xhr.js";
import {validateHomeServer} from "./matrix/HomeServer.js";
import {Link, LinkKind} from "./Link.js";
import {RootViewModel} from "./RootViewModel.js";
export async function main() {
const link = Link.parseFragment(location.hash);
if (!link) {
throw new Error("bad link");
}
const hs = await validateHomeServer(xhrRequest, link.servers[0]);
if (link.kind === LinkKind.User) {
const profile = await hs.getUserProfile(link.identifier);
const imageURL = hs.mxcUrlThumbnail(profile.avatar_url, 64, 64, "crop");
console.log(imageURL);
}
export async function main(container) {
const vm = new RootViewModel(xhrRequest, location.hash);
vm.load();
window.__rootvm = vm;
// const view = new RootView(vm);
// container.appendChild(view.mount());
}