diff --git a/src/Pages/Robotics/Robots/index.js b/src/Pages/Robotics/Robots/index.js
index 5bac544..42db44c 100644
--- a/src/Pages/Robotics/Robots/index.js
+++ b/src/Pages/Robotics/Robots/index.js
@@ -226,7 +226,7 @@ export default function Robots() {
"PATCH",
{
robotId: record.id,
- name: selectedRobotName,
+ robotName: selectedRobotName,
},
{},
myFetchContentType.JSON,
@@ -477,6 +477,8 @@ export default function Robots() {
});
break;
case ReceivedSSECommands.AddUnauthorizedRobot:
+ console.log("a", unauthorizedRobotsPaginationPageRef.current);
+
if (unauthorizedRobotsPaginationPageRef.current === 1) {
setUnauthorizedRobots((arr) => {
const newArr = [...arr];
@@ -547,8 +549,9 @@ export default function Robots() {
// if user is on the last page and the last item is removed, we need to go back one page
if (
+ body.UnauthorizedRobotsTotalPages > 0 &&
unauthorizedRobotsPaginationPageRef.current >
- body.UnauthorizedRobotsTotalPages
+ body.UnauthorizedRobotsTotalPages
) {
unauthorizedRobotsPaginationPageRef.current--;
setUnauthorizedRobotsPaginationPage(
@@ -574,7 +577,10 @@ export default function Robots() {
setUnauthorizedRobotsTotalPages(body.TotalPages);
// if user is on the last page and the last item is removed, we need to go back one page
- if (unauthorizedRobotsPaginationPageRef.current > body.TotalPages) {
+ if (
+ body.TotalPages > 0 &&
+ unauthorizedRobotsPaginationPageRef.current > body.TotalPages
+ ) {
unauthorizedRobotsPaginationPageRef.current--;
setUnauthorizedRobotsPaginationPage(
unauthorizedRobotsPaginationPageRef.current
@@ -597,7 +603,10 @@ export default function Robots() {
setRobotsTotalPages(body.TotalPages);
// if user is on the last page and the last item is removed, we need to go back one page
- if (robotsPaginationPageRef.current > body.TotalPages) {
+ if (
+ body.TotalPages > 0 &&
+ robotsPaginationPageRef.current > body.TotalPages
+ ) {
robotsPaginationPageRef.current--;
setRobotsPaginationPage(robotsPaginationPageRef.current);
}
@@ -609,7 +618,7 @@ export default function Robots() {
const index = arr.findIndex((x) => x.Id === body.RobotId);
if (index !== -1) {
- newArr[index].Name = body.Name;
+ newArr[index].Name = body.RobotName;
}
return newArr;
@@ -715,29 +724,25 @@ export default function Robots() {
totalPages={robotsTotalPages}
/>
- {unauthorizedRobots.length > 0 && (
- <>
-