Browse Source

declare tribe

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
c91d1c8981
  1. 25
      api/utils/tribes.ts
  2. 27
      dist/api/utils/tribes.js
  3. 2
      dist/api/utils/tribes.js.map

25
api/utils/tribes.ts

@ -11,14 +11,14 @@ const config = require(path.join(__dirname,'../../config/app.json'))[env]
let client:any
export async function testCreate(){
const uuid = await genSignedTimestamp()
const name='test'
declare({
uuid,name,groupKey:'asdf',host:config.tribes_host,
pricePerMessage:0,priceToJoin:0,description:'',tags:[]
})
}
// export async function testCreate(){
// const uuid = await genSignedTimestamp()
// const name='test'
// declare({
// uuid,name,groupKey:'asdf',host:config.tribes_host,
// pricePerMessage:0,priceToJoin:0,description:'',tags:[]
// })
// }
export async function connect(onMessage) {
try{
@ -62,14 +62,15 @@ export function publish(topic,msg){
if(client) client.publish(topic,msg)
}
export async function declare({uuid,name,description,tags,groupKey,host,pricePerMessage,priceToJoin}) {
export async function declare({uuid,name,description,tags,img,groupKey,host,pricePerMessage,priceToJoin}) {
const r = await fetch('https://' + host + '/tribes', {
method: 'POST' ,
body: JSON.stringify({
uuid,name,groupKey,host,
description,tags,
uuid, groupKey,
name, description, tags, img:img||'',
pricePerMessage:pricePerMessage||0,
priceToJoin:priceToJoin||0
priceToJoin:priceToJoin||0,
}),
headers: { 'Content-Type': 'application/json' }
})

27
dist/api/utils/tribes.js

@ -18,17 +18,14 @@ const fetch = require("node-fetch");
const env = process.env.NODE_ENV || 'development';
const config = require(path.join(__dirname, '../../config/app.json'))[env];
let client;
function testCreate() {
return __awaiter(this, void 0, void 0, function* () {
const uuid = yield genSignedTimestamp();
const name = 'test';
declare({
uuid, name, groupKey: 'asdf', host: config.tribes_host,
pricePerMessage: 0, priceToJoin: 0, description: '', tags: []
});
});
}
exports.testCreate = testCreate;
// export async function testCreate(){
// const uuid = await genSignedTimestamp()
// const name='test'
// declare({
// uuid,name,groupKey:'asdf',host:config.tribes_host,
// pricePerMessage:0,priceToJoin:0,description:'',tags:[]
// })
// }
function connect(onMessage) {
return __awaiter(this, void 0, void 0, function* () {
try {
@ -77,15 +74,15 @@ function publish(topic, msg) {
client.publish(topic, msg);
}
exports.publish = publish;
function declare({ uuid, name, description, tags, groupKey, host, pricePerMessage, priceToJoin }) {
function declare({ uuid, name, description, tags, img, groupKey, host, pricePerMessage, priceToJoin }) {
return __awaiter(this, void 0, void 0, function* () {
const r = yield fetch('https://' + host + '/tribes', {
method: 'POST',
body: JSON.stringify({
uuid, name, groupKey, host,
description, tags,
uuid, groupKey,
name, description, tags, img: img || '',
pricePerMessage: pricePerMessage || 0,
priceToJoin: priceToJoin || 0
priceToJoin: priceToJoin || 0,
}),
headers: { 'Content-Type': 'application/json' }
});

2
dist/api/utils/tribes.js.map

@ -1 +1 @@
{"version":3,"file":"tribes.js","sourceRoot":"","sources":["../../../api/utils/tribes.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,iCAAgC;AAChC,qCAAoC;AACpC,mCAAkC;AAClC,6BAA4B;AAC5B,6BAA4B;AAC5B,oCAAmC;AAEnC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAA;AACjD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAEzE,IAAI,MAAU,CAAA;AAEd,SAAsB,UAAU;;QAC5B,MAAM,IAAI,GAAG,MAAM,kBAAkB,EAAE,CAAA;QACvC,MAAM,IAAI,GAAC,MAAM,CAAA;QACjB,OAAO,CAAC;YACJ,IAAI,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,IAAI,EAAC,MAAM,CAAC,WAAW;YACjD,eAAe,EAAC,CAAC,EAAC,WAAW,EAAC,CAAC,EAAC,WAAW,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE;SACzD,CAAC,CAAA;IACN,CAAC;CAAA;AAPD,gCAOC;AAED,SAAsB,OAAO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