webterm: fix broken api interactions

We hadn't adapted to the new subscription event callback yet, and were
sending a slightly misshapen herm task for pokes.
This commit is contained in:
Fang 2021-06-28 14:44:35 +02:00
parent 4ccfae930c
commit 329ec8ef3f
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
3 changed files with 4 additions and 9 deletions

View File

@ -393,8 +393,6 @@ export default function TermApp(props: TermAppProps) {
// open subscription // open subscription
// //
// TODO start default session alongside other landscape subscriptions,
// once subscription refactor is in.
api.subscribe({ app: 'herm', path: '/session/'+selected, api.subscribe({ app: 'herm', path: '/session/'+selected,
event: (e) => { event: (e) => {
const ses = useTermState.getState().sessions[selected]; const ses = useTermState.getState().sessions[selected];
@ -402,7 +400,7 @@ export default function TermApp(props: TermAppProps) {
console.log('on blit: no such session', selected, sessions, useTermState.getState().sessions); console.log('on blit: no such session', selected, sessions, useTermState.getState().sessions);
return; return;
} }
showBlit(ses.term, e.data); showBlit(ses.term, e);
}, },
quit: () => { // quit quit: () => { // quit
// TODO show user a message // TODO show user a message

View File

@ -1,13 +1,13 @@
import _ from 'lodash'; import _ from 'lodash';
import { Scry } from '../lib' import { Scry } from '../lib'
import { Enc, Path, Patp, PatpNoSig, Poke, Thread } from '../lib/types'; import { Poke } from '../lib/types';
import { Belt, Task, SessionTask } from './types'; import { Belt, Task, SessionTask } from './types';
export const pokeTask = (session: string, task: Task): Poke<SessionTask> => ({ export const pokeTask = (session: string, task: Task): Poke<SessionTask> => ({
app: 'herm', app: 'herm',
mark: 'herm-task', mark: 'herm-task',
json: { session, task } json: { session, ...task }
}); });
export const pokeBelt = ( export const pokeBelt = (

View File

@ -57,7 +57,4 @@ export type Task =
| { hail: null } | { hail: null }
| { hook: null } | { hook: null }
export type SessionTask = { export type SessionTask = { session: string } & Task
session: string,
task: Task
}