fix loop in phone numbers page

This commit is contained in:
Dave Horton
2021-06-21 13:33:43 -04:00
parent 09b0bc8dde
commit 35889ba122
2 changed files with 5 additions and 5 deletions
@@ -98,7 +98,7 @@ const CarriersList = () => {
console.log(err.response || err);
}
}
}, [currentServiceProvider]);
}, [currentServiceProvider, history, dispatch]);
//=============================================================================
// Delete sip trunk
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useContext } from 'react';
import React, { useState, useEffect, useContext, useCallback } from 'react';
import axios from 'axios';
import { useHistory } from 'react-router-dom';
import { NotificationDispatchContext } from '../../../contexts/NotificationContext';
@@ -14,12 +14,12 @@ const PhoneNumbersList = () => {
useEffect(() => {
document.title = `Phone Number Routing | Jambonz | Open Source CPAAS`;
});
}, []);
//=============================================================================
// Get phone numbers
//=============================================================================
const getPhoneNumbers = async () => {
const getPhoneNumbers = useCallback(async () => {
try {
if (!localStorage.getItem('token')) {
history.push('/');
@@ -124,7 +124,7 @@ const PhoneNumbersList = () => {
console.log(err.response || err);
}
}
};
}, [currentServiceProvider, dispatch, history]);
//=============================================================================
// Delete phone number