Skip to content

Commit

Permalink
get access token from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenvanhuan243 committed Apr 13, 2024
1 parent 577b065 commit 9306699
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/containers/HomePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Footer from 'components/Footer';
import VideoCard from 'components/VideoCard/Item/Loadable';
import LoadingList from 'components/VideoCard/LoadingList/Loadable';
import MovieAPI from '../../api/backend/movies';
import UserUtils from '../../../utils/user/UserUtils';
import config from '../../../config';

export default function HomePage() {
Expand Down Expand Up @@ -49,9 +50,7 @@ export default function HomePage() {

const connectToSocket = () => {
try {
const token = localStorage.getItem("accessToken")
console.log("Socket #####", token)
const cable = new WebSocket(`${config.SOCKET_BASE_URL}?token=${token}`);
const cable = new WebSocket(`${config.SOCKET_BASE_URL}?token=${UserUtils.getAccessToken()}`);
cable.onopen = () => {
console.log('Connected to Action Cable')

Expand Down

0 comments on commit 9306699

Please sign in to comment.