diff --git a/app/components/inappchat/inappchat.js b/app/components/inappchat/inappchat.js
index 4053d07d..092266cf 100644
--- a/app/components/inappchat/inappchat.js
+++ b/app/components/inappchat/inappchat.js
@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import { Rocketchat } from "@rocket.chat/sdk";
+import Cookie from 'js-cookie';
import { getMessages, sendMessage } from "./lib/api";
import styles from "../../styles/Inappchat.module.css";
import { emojify, messagesSortedByDate } from "./helpers";
@@ -22,8 +23,9 @@ import InappchatTextInput from "./inappchattextinput";
const rcClient = new Rocketchat({ logger: console, protocol: "ddp" });
-const InAppChat = ({ host, closeChat, cookies, rid }) => {
+const InAppChat = ({ host, closeChat, rid }) => {
const [messages, setMessages] = useState([]);
+ const cookies = { rc_token: Cookie.get('rc_token'), rc_uid: Cookie.get('rc_uid') };
const isAuth = cookies.rc_token && cookies.rc_uid;
const rcURL = new URL(host);
const useSsl = !/http:\/\//.test(host);
@@ -97,7 +99,7 @@ const InAppChat = ({ host, closeChat, cookies, rid }) => {
) : (
Please login into{" "}
-
+
RocketChat
{" "}
to chat!
@@ -105,7 +107,7 @@ const InAppChat = ({ host, closeChat, cookies, rid }) => {
)}
- {cookies.rc_token && cookies.rc_uid && }
+ {isAuth && }
);
};
diff --git a/app/package.json b/app/package.json
index 4609703e..69bc1b8b 100644
--- a/app/package.json
+++ b/app/package.json
@@ -19,6 +19,7 @@
"dompurify": "^2.3.5",
"emoji-toolkit": "^6.6.0",
"firebase": "^9.6.3",
+ "js-cookie": "^3.0.1",
"marked": "^4.0.12",
"next": "12.0.7",
"next-auth": "^4.2.1",
diff --git a/app/pages/virtualconf/greenroom/index.js b/app/pages/virtualconf/greenroom/index.js
index 2ca52c65..28dcd1a1 100644
--- a/app/pages/virtualconf/greenroom/index.js
+++ b/app/pages/virtualconf/greenroom/index.js
@@ -7,8 +7,9 @@ import InAppChat from "../../../components/inappchat/inappchat";
import { Button } from "react-bootstrap";
const greenroom_rid = process.env.NEXT_PUBLIC_ROCKET_CHAT_GREENROOM_RID;
+const host = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://community.liaison.rocketchat.digital";
-const Greenroom = ({ cookies }) => {
+const Greenroom = () => {
const [openChat, setOpenChat] = useState(false);
const handleOpenChat = () => {
@@ -23,7 +24,7 @@ const Greenroom = ({ cookies }) => {
{openChat ? (
-
+
) : (
)}
@@ -41,11 +42,3 @@ const Greenroom = ({ cookies }) => {
}
export default Greenroom;
-
-Greenroom.getInitialProps = ({ req }) => {
- const cookies = req.cookies;
-
- return {
- cookies,
- };
- };
diff --git a/app/pages/virtualconf/mainstage/[id].js b/app/pages/virtualconf/mainstage/[id].js
index ace57767..625ea94b 100644
--- a/app/pages/virtualconf/mainstage/[id].js
+++ b/app/pages/virtualconf/mainstage/[id].js
@@ -5,8 +5,9 @@ import Videostreamer from "../../../components/clientsideonly/videostreamer";
import InAppChat from '../../../components/inappchat/inappchat';
const rid = process.env.NEXT_PUBLIC_ROCKET_CHAT_CONF_RID;
+const host = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://community.liaison.rocketchat.digital";
-export default function ConfMainStage({ cookies }) {
+export default function ConfMainStage() {
const [openChat, setOpenChat] = useState(false);
const handleOpenChat = () => {
@@ -32,7 +33,7 @@ export default function ConfMainStage({ cookies }) {
{openChat ? (
-
+
) : (
)}
@@ -40,11 +41,3 @@ export default function ConfMainStage({ cookies }) {
>
);
}
-
-ConfMainStage.getInitialProps = ({ req }) => {
- const cookies = req.cookies;
-
- return {
- cookies,
- };
-};