@@ -377,6 +377,8 @@ export function* socketConnectedSaga({ isAnonymous, socket, domainKey }) {
377
377
* @param {string} params.domainKey - domain for socket
378
378
*/
379
379
export function * socketErrorSaga ({ error, socketState, domainKey }) {
380
+ // here you should check if your token is valid or not expired, if not
381
+ // disconnect phoenix
380
382
console .error (' socketErrorSaga' ,{ error, socketState, domainKey });
381
383
}
382
384
@@ -386,20 +388,20 @@ export function* socketErrorSaga({ error, socketState, domainKey }) {
386
388
* @param {Object} params - parameters
387
389
* @param {Object} params.socket = socket being closed
388
390
* @param {string} params.domainKey - domain for socket
389
- * @param {boolean } params.isAnonymous - true if socket was anonymous
391
+ * @param {object } params.params - socket.params()
390
392
*/
391
- export function * socketCloseSaga ({ isAnonymous , socket, domainKey }) {
392
- console .info (' socketCloseSaga' ,{ isAnonymous , socket, domainKey });
393
+ export function * socketCloseSaga ({ params , socket, domainKey }) {
394
+ console .info (' socketCloseSaga' ,{ params , socket, domainKey });
393
395
}
394
396
/**
395
397
* After phoenix socket disconnects
396
398
* @param {Object} params - parameters
397
399
* @param {Object} params.socket = socket being disconnected
398
400
* @param {string} params.domainKey - domain for socket
399
- * @param {boolean } params.isAnonymous - true if socket was anonymous
401
+ * @param {Object } params.params - socket.params()
400
402
*/
401
- export function * socketDisconnectionSaga ({ isAnonymous , socket, domainKey }) {
402
- console .info (' socketDisconnectionSaga' ,{ isAnonymous , socket, domainKey });
403
+ export function * socketDisconnectionSaga ({ params , socket, domainKey }) {
404
+ console .info (' socketDisconnectionSaga' ,{ params , socket, domainKey });
403
405
}
404
406
405
407
export default function * defaultSaga () {
@@ -439,11 +441,7 @@ const appReducer = (state = initialState, action) =>
439
441
case PHOENIX_CHANNEL_END_PROGRESS :
440
442
// when the progress for loadingStatusKey for channel has completed
441
443
{
442
- const loadingStatusKey = _ .get (
443
- action,
444
- ' data.loadingStatusKey' ,
445
- false
446
- );
444
+ const loadingStatusKey = action .data .loadingStatusKey
447
445
if (! loadingStatusKey) {
448
446
draft .loading = false ;
449
447
} else {
@@ -453,7 +451,7 @@ const appReducer = (state = initialState, action) =>
453
451
break ;
454
452
case PHOENIX_CHANNEL_LOADING_STATUS :
455
453
// when the progress for loadingStatusKey is being updated
456
- draft .loadingStatus [_ . get ( action, ' data.loadingStatusKey' , ' ' ) ] = {
454
+ draft .loadingStatus [action . data .loadingStatusKey ] = {
457
455
status: true ,
458
456
};
459
457
break ;
0 commit comments