mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-18 07:35:19 +00:00
session, media_files/list endpoints
This commit is contained in:
@@ -8,11 +8,12 @@ import {
|
||||
} from "@storyteller/studio";
|
||||
import { ButtonElement } from "@storyteller/studio-ui/button";
|
||||
import {
|
||||
MediaFileType,
|
||||
SceneHierarchyElement,
|
||||
StorytellerApi,
|
||||
StudioURLParams,
|
||||
} from "@storyteller/studio-web";
|
||||
import { match } from "@storyteller/utility";
|
||||
import { assert, match } from "@storyteller/utility";
|
||||
import { LitElement, html, nothing } from "lit";
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import { classMap } from "lit/directives/class-map.js";
|
||||
@@ -66,6 +67,37 @@ export class AppElement extends LitElement {
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO
|
||||
override async connectedCallback(): Promise<void> {
|
||||
try {
|
||||
const session = await this.api.session();
|
||||
console.log("session:", session);
|
||||
|
||||
if (!session.logged_in)
|
||||
return; // TODO: Prompt for login?
|
||||
|
||||
assert(session.user?.username != null);
|
||||
|
||||
const mediaFilesResult = await this.api.listMediaFiles({
|
||||
username: session.user.username,
|
||||
filterMediaType: [
|
||||
MediaFileType.Bvh,
|
||||
MediaFileType.Fbx,
|
||||
MediaFileType.Glb,
|
||||
MediaFileType.Gltf,
|
||||
MediaFileType.Mocap,
|
||||
MediaFileType.ScnRon,
|
||||
],
|
||||
});
|
||||
console.log(mediaFilesResult);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
super.connectedCallback();
|
||||
}
|
||||
|
||||
@on("scene-saved")
|
||||
async onSceneSaved({ detail: scene }: SceneSavedEvent): Promise<void> {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user