Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
omzi committed Sep 27, 2021
1 parent 91b54d5 commit 8499dfe
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ npm-debug.log_
yarn-debug.log*
yarn-error.log*
yarn.lock
# package-lock.json
package-lock.json

# Runtime data

Expand Down
12 changes: 5 additions & 7 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"start:standalone": "webpack serve --env standalone",
"build": "concurrently yarn:build:*",
"build-npm": "concurrently npm:build:*",
"build:webpack": "NODE_ENV=production webpack --mode=production",
"build:webpack": "cross-env NODE_ENV=production webpack --mode=production",
"analyze": "webpack --mode=production --env analyze",
"lint": "eslint src --ext js",
"format": "prettier --write .",
Expand All @@ -21,12 +21,12 @@
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.5",
"@babel/runtime": "^7.15.3",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"autoprefixer": "^9.8.6",
"babel-jest": "^27.0.6",
"concurrently": "^6.2.1",
"cross-env": "^7.0.3",
"css-loader": "^6.3.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
Expand Down Expand Up @@ -73,12 +73,10 @@
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/react-fontawesome": "^0.1.15",
"@headlessui/react": "^1.4.1",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^0.21.1",
"centrifuge": "^2.8.0",
"cropperjs": "^1.5.12",
"cross-env": "^7.0.3",
"d3": "^7.0.1",
"dayjs": "^1.10.7",
"docx": "^6.0.3",
Expand Down
33 changes: 14 additions & 19 deletions frontend/src/helpers/realtime.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,22 @@ import Centrifuge from "centrifuge";
import axios from "axios";

// const centrifuge = new Centrifuge("ws://localhost:8000/connection/websocket");
const centrifuge = new Centrifuge(
"wss://realtime.zuri.chat/connection/websocket"
);
const centrifuge = new Centrifuge("wss://realtime.zuri.chat/connection/websocket");

class RealTime {

static subscribe = (channel, apiRoute, callback) => {

centrifuge.on("connect", async (data) => {
await axios.get(`https://companyfiles.zuri.chat/api/v1/${apiRoute}`)
console.log(data);
});

centrifuge.on("disconnect", (data) => {
console.log(data);
});

centrifuge.connect();
centrifuge.subscribe(channel, callback)
}

static subscribe = (channel, apiRoute, callback) => {
centrifuge.on("connect", async (data) => {
await axios.get(`https://companyfiles.zuri.chat/api/v1/${apiRoute}`);
console.log(data);
});

centrifuge.on("disconnect", (data) => {
console.log(data);
});

centrifuge.connect();
centrifuge.subscribe(channel, callback);
}
}

export default RealTime;

0 comments on commit 8499dfe

Please sign in to comment.