File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ const CustomerSupportChat = ({socket}) => {
20
20
} , [ selectedConversation ] )
21
21
22
22
useEffect ( ( ) => {
23
+ const loginStatus = localStorage . getItem ( "executiveID" ) ;
24
+ if ( loginStatus == null ) {
25
+ navigate ( "/login" )
26
+ }
23
27
socket . emit ( 'load-chats-for-executive' )
24
28
socket . on ( "convos-for-executive" , ( chats ) => {
25
29
console . log ( chats )
@@ -28,8 +32,8 @@ const CustomerSupportChat = ({socket}) => {
28
32
socket . on ( 'new-customer-for-executive' , ( chat ) => {
29
33
console . log ( "chats" , chat )
30
34
setOriginalListOfConvos ( chats => [ chat , ...chats ] )
31
-
32
35
} )
36
+
33
37
} , [ ] )
34
38
35
39
socket . on ( "user-disconected" , ( socketID ) => {
Original file line number Diff line number Diff line change 1
1
import React , { useEffect , useState } from 'react' ;
2
2
import './CustomerSupportForm.css' ; // Import the stylesheet
3
- import { useLocation } from 'react-router-dom' ;
3
+ import { useLocation , useNavigate } from 'react-router-dom' ;
4
4
5
5
const CustomerSupportForm = ( { socket} ) => {
6
6
const { state} = useLocation ( ) ;
@@ -15,9 +15,15 @@ const CustomerSupportForm = ({socket}) => {
15
15
solutionSummary : '' ,
16
16
noQueryReason : '' ,
17
17
} ) ;
18
+
19
+ const navigate = useNavigate ( ) ;
18
20
19
21
// To handle form response
20
22
useEffect ( ( ) => {
23
+ const loginStatus = localStorage . getItem ( "executiveID" ) ;
24
+ if ( loginStatus == null ) {
25
+ navigate ( "/login" )
26
+ }
21
27
socket . on ( 'form-response' , ( data ) => {
22
28
if ( data . success ) {
23
29
alert ( 'Form submitted successfully!' ) ;
You can’t perform that action at this time.
0 commit comments