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) { 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]); this.bindPaths = _.uniq([...this.bindPaths, path]);
window.subscriptionId = window.urb.subscribe(ship, appl, path, window.subscriptionId = window.urb.subscribe(ship, appl, path,

View File

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

View File

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