fix: apps throws an error when importing contacts from phone

This commit is contained in:
canove
2020-10-17 11:16:17 -03:00
parent 55fbadc86e
commit f3ecb5dbd0
6 changed files with 21 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect, useReducer } from "react";
import openSocket from "socket.io-client";
import { toast } from "react-toastify";
import { useHistory } from "react-router-dom";
import { makeStyles } from "@material-ui/core/styles";
import Table from "@material-ui/core/Table";
@@ -86,6 +87,7 @@ const useStyles = makeStyles(theme => ({
const Contacts = () => {
const classes = useStyles();
const history = useHistory();
const [loading, setLoading] = useState(false);
const [pageNumber, setPageNumber] = useState(1);
@@ -191,6 +193,7 @@ const Contacts = () => {
const handleimportContact = async () => {
try {
await api.post("/contacts/import");
history.go(0);
} catch (err) {
const errorMsg = err.response?.data?.error;
if (errorMsg) {