🎉
This commit is contained in:
parent
7609892c1f
commit
d392da64ab
14 changed files with 34 additions and 20 deletions
|
|
@ -24,7 +24,7 @@ module.exports = (i, endpoint, data = {}) => {
|
|||
|
||||
return new Promise((resolve, reject) => {
|
||||
// Send request
|
||||
fetch(endpoint.indexOf('://') > -1 ? endpoint : `${CONFIG.api.url}/${endpoint}`, {
|
||||
fetch(endpoint.indexOf('://') > -1 ? endpoint : `${CONFIG.apiUrl}/${endpoint}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
credentials: endpoint === 'signin' ? 'include' : 'omit'
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Connection {
|
|||
this.event = riot.observable();
|
||||
this.me = me;
|
||||
|
||||
const host = CONFIG.api.url.replace('http', 'ws');
|
||||
const host = CONFIG.apiUrl.replace('http', 'ws');
|
||||
this.socket = new ReconnectingWebSocket(`${host}/messaging?i=${me.token}&otherparty=${otherparty}`);
|
||||
this.socket.addEventListener('open', this.onOpen);
|
||||
this.socket.addEventListener('message', this.onMessage);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ module.exports = me => {
|
|||
let state = 'initializing';
|
||||
const stateEv = riot.observable();
|
||||
const event = riot.observable();
|
||||
const host = CONFIG.api.url.replace('http', 'ws');
|
||||
const host = CONFIG.apiUrl.replace('http', 'ws');
|
||||
const socket = new ReconnectingWebSocket(`${host}?i=${me.token}`);
|
||||
|
||||
socket.onopen = () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue