Successfully sending something to frontend

This commit is contained in:
ronreg-ribdev 2020-05-23 05:29:33 -07:00
parent b2b46a77c1
commit 3c0f460993
3 changed files with 25 additions and 7 deletions

View File

@ -9,6 +9,7 @@ class UrbitApi {
}
bind(path, method, ship = this.authTokens.ship, appl = "bartinfo", success, fail) {
console.log(`Calling api.bind() with path ${path} ship ${ship} method ${method}`);
this.bindPaths = _.uniq([...this.bindPaths, path]);
window.subscriptionId = window.urb.subscribe(ship, appl, path,

View File

@ -6,18 +6,21 @@ import urbitOb from 'urbit-ob';
export class Subscription {
start() {
console.log("Calling start()")
if (api.authTokens) {
// this.initializebartinfo();
console.log("would initialize");
this.initializebartinfo();
} else {
console.error("~~~ ERROR: Must set api.authTokens before operation ~~~");
}
}
// initializebartinfo() {
// api.bind('/primary', 'PUT', api.authTokens.ship, 'bartinfo',
// this.handleEvent.bind(this),
// this.handleError.bind(this));
// }
initializebartinfo() {
console.log("Initialize bart info");
api.bind('/primary', 'PUT', api.authTokens.ship, 'bartinfo',
this.handleEvent.bind(this),
this.handleError.bind(this));
}
handleEvent(diff) {
store.handleEvent(diff);
@ -25,9 +28,11 @@ export class Subscription {
handleError(err) {
console.error(err);
/*
api.bind('/primary', 'PUT', api.authTokens.ship, 'bartinfo',
this.handleEvent.bind(this),
this.handleError.bind(this));
*/
}
}

View File

@ -54,6 +54,14 @@
^- (quip card _this)
?> (team:title our.bol src.bol)
?+ mark (on-poke:def mark vase)
%noun
?+ q.vase (on-poke:def mark vase)
%print-chutney ~& "CHUTNEY" [~ this]
%print-state ~& this [~ this]
%give-number [[%give %fact ~[/primary] %json !>(*json)]~ this]
::%yolo [[%give %fact ~ %noun [@ 299]]~ this]
::%hella [[%give %fact ~ %json !>((bogus-json:cc))]~ this]
==
%handle-http-request
=+ !<([eyre-id=@ta =inbound-request:eyre] vase)
:_ this
@ -66,6 +74,10 @@
++ on-watch
|= =path
^- (quip card:agent:gall _this)
~& "on-watch path: {<path>}"
?: ?=([%primary *] path)
:_ this
[%give %fact ~ %json !>((bogus-json:cc))]~
?: ?=([%http-response *] path)
`this
?. =(/ path)
@ -120,7 +132,7 @@
^- json
%- pairs:enjs:format
:~
success+b+%.n
success+b+%.y
==
++ request-bart-stations
^- request:http