subscribe to contact-store, fill groups headers

This commit is contained in:
Matilde Park 2019-11-26 16:53:06 -05:00 committed by Logan Allen
parent 2aefc02112
commit 462b14bf58
4 changed files with 20 additions and 40 deletions

View File

@ -58686,17 +58686,13 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
class Subscription {
start() {
if (api.authTokens) {
this.initializeChat();
this.initializeContacts();
} else {
console.error("~~~ ERROR: Must set api.authTokens before operation ~~~");
}
}
initializeChat() {
api.bind('/primary', 'PUT', api.authTokens.ship, 'chat-view',
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
initializeContacts() {
api.bind('/primary', 'PUT', api.authTokens.ship, 'invite-view',
this.handleEvent.bind(this),
this.handleError.bind(this),
@ -58705,6 +58701,10 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
api.bind('/primary', 'PUT', api.authTokens.ship, 'contact-store',
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
api.bind('/all', 'PUT', api.authTokens.ship, 'permission-store',
this.handleEvent.bind(this),
this.handleError.bind(this),
@ -58712,6 +58712,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
handleEvent(diff) {
console.log(diff);
store.handleEvent(diff);
}
@ -58726,18 +58727,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
handleQuitAndResubscribe(quit) {
// TODO: resubscribe
}
fetchMessages(start, end, path) {
console.log(start, end, path);
fetch(`/~chat/paginate/${start}/${end}${path}`)
.then((response) => response.json())
.then((json) => {
store.handleEvent({
data: json
});
});
}
}
let subscription = new Subscription();
@ -58788,13 +58777,14 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
const _jsxFileName$3 = "/Users/matilde/git/urbit/pkg/interface/contacts/src/js/groups.js";
const _jsxFileName$3 = "/Users/matilde/git/urbit/pkg/interface/contacts/src/js/components/groups.js";
class Groups extends react_1 {
// drawer to the left
render() {
return (
react.createElement('div', { className: "br b--gray4 h-100 flex-basis-100-s flex-basis-300-ns" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 7}}
, react.createElement('h2', { className: "f9 gray2" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 8}}, "Your Root Identity" )
, react.createElement('h2', { className: "f9 pa4 gray2" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 8}}, "Your Root Identity" )
, react.createElement('h2', { className: "f9 pa4 gray2" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 9}}, "Your Groups" )
)
)
}

View File

@ -5,7 +5,8 @@ export class Groups extends Component {
render() {
return (
<div className="br b--gray4 h-100 flex-basis-100-s flex-basis-300-ns">
<h2 className="f9 gray2">Your Root Identity</h2>
<h2 className="f9 pa4 gray2">Your Root Identity</h2>
<h2 className="f9 pa4 gray2">Your Groups</h2>
</div>
)
}

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import classnames from 'classnames';
import { HeaderBar } from './lib/header-bar';
import { Groups } from '../groups';
import { Groups } from './groups';
export class Skeleton extends Component {
render() {

View File

@ -7,17 +7,13 @@ import urbitOb from 'urbit-ob';
export class Subscription {
start() {
if (api.authTokens) {
this.initializeChat();
this.initializeContacts();
} else {
console.error("~~~ ERROR: Must set api.authTokens before operation ~~~");
}
}
initializeChat() {
api.bind('/primary', 'PUT', api.authTokens.ship, 'chat-view',
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
initializeContacts() {
api.bind('/primary', 'PUT', api.authTokens.ship, 'invite-view',
this.handleEvent.bind(this),
this.handleError.bind(this),
@ -26,6 +22,10 @@ export class Subscription {
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
api.bind('/primary', 'PUT', api.authTokens.ship, 'contact-store',
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
api.bind('/all', 'PUT', api.authTokens.ship, 'permission-store',
this.handleEvent.bind(this),
this.handleError.bind(this),
@ -33,6 +33,7 @@ export class Subscription {
}
handleEvent(diff) {
console.log(diff);
store.handleEvent(diff);
}
@ -47,18 +48,6 @@ export class Subscription {
handleQuitAndResubscribe(quit) {
// TODO: resubscribe
}
fetchMessages(start, end, path) {
console.log(start, end, path);
fetch(`/~chat/paginate/${start}/${end}${path}`)
.then((response) => response.json())
.then((json) => {
store.handleEvent({
data: json
});
});
}
}
export let subscription = new Subscription();