This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useState, useContext } from 'react'; | |
| import axios from 'axios'; | |
| import { useHistory } from 'react-router'; | |
| import Header from '../common/Header'; | |
| import Create from './Create'; | |
| import Join from './Join'; | |
| import Context from '../../context'; | |
| const Home = () => { | |
| const [meetings, setMeetings] = useState([]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useRef, useContext } from 'react'; | |
| import { v4 as uuidv4 } from "uuid"; | |
| import axios from 'axios'; | |
| import Context from '../../context'; | |
| const Create = (props) => { | |
| const { toggleCreate } = props; | |
| const { user, cometChat, setIsLoading, setHasNewMeeting } = useContext(Context); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useContext } from 'react'; | |
| import Context from '../../context'; | |
| import { useHistory } from 'react-router-dom'; | |
| function Header(props) { | |
| const { toggleCreate, toggleJoin } = props; | |
| const { user, setUser, cometChat } = useContext(Context); | |
| const history = useHistory(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const createCometChatAccount = async ({ id, fullname, avatar }) => { | |
| const authKey = `${process.env.REACT_APP_COMETCHAT_AUTH_KEY}`; | |
| const user = new cometChat.User(id); | |
| user.setName(fullname); | |
| user.setAvatar(avatar); | |
| return await cometChat.createUser(user, authKey); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useRef, useContext } from "react"; | |
| import validator from "validator"; | |
| import { v4 as uuidv4 } from "uuid"; | |
| import axios from 'axios'; | |
| import Context from "../../context"; | |
| function SignUp(props) { | |
| const { toggleModal } = props; | |
| const { cometChat, setIsLoading } = useContext(Context); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState } from 'react'; | |
| const withModal = ModalComponent => WrapperComponent => { | |
| return function (props) { | |
| const [isModalShown, setIsModalShown] = useState(false); | |
| return ( | |
| <> | |
| <WrapperComponent toggleModal={setIsModalShown} {...props} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const loginCometChat = async (user) => { | |
| const authKey = `${process.env.REACT_APP_COMETCHAT_AUTH_KEY}`; | |
| return await cometChat.login(user.id, authKey); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useRef, useContext } from "react"; | |
| import validator from "validator"; | |
| import { useHistory } from 'react-router-dom'; | |
| import axios from 'axios'; | |
| import withModal from "../common/Modal"; | |
| import SignUp from "../register/SignUp"; | |
| import Context from "../../context"; | |
| const Login = (props) => { | |
| const { toggleModal } = props; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| useEffect(() => { | |
| initCometChat(); | |
| }, []); | |
| const initCometChat = async () => { | |
| const { CometChat } = await import('@cometchat-pro/chat'); | |
| const appID = `${process.env.REACT_APP_COMETCHAT_APP_ID}`; | |
| const region = `${process.env.REACT_APP_COMETCHAT_REGION}`; | |
| const appSetting = new CometChat.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.get("/meetings/:id/get", (req, res) => { | |
| const id = req.params.id; | |
| const findMeetingSql = "SELECT * FROM meeting WHERE meeting_uid = ?"; | |
| dbConn.query(findMeetingSql, [id], function (error, meeting) { | |
| res.status(200).jsonp(meeting); | |
| }); | |
| }); |