Skip to content

Commit

Permalink
fix: be more restrictive about saving without an internet connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Struck committed Feb 5, 2024
1 parent 0bd7c1f commit ffbb4bd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion native/screens/DeliveryTabScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export default function DeliveryTabScreen({
showInfo("Brak zmian do zapisania");
return;
}
if (!isConnected) {
showError("Brak połączenia z internetem");
return;
}
mutate(data);
},
(_errors) => {
Expand Down Expand Up @@ -118,7 +122,7 @@ export default function DeliveryTabScreen({
});
}}
>
<ScanBarcodeIcon size={34} />
<ScanBarcodeIcon size={34} color="darkGrey" />
</Button>
</View>
{recordList.map(({ name, quantity, unit, id }) => (
Expand Down
6 changes: 5 additions & 1 deletion native/screens/InventoryTabScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export default function InventoryTabScreen({
showInfo("Brak zmian do zapisania");
return;
}
if (!isConnected) {
showError("Brak połączenia z internetem");
return;
}
mutate(data);
},
(_errors) => {
Expand Down Expand Up @@ -107,7 +111,7 @@ export default function InventoryTabScreen({
});
}}
>
<ScanBarcodeIcon size={34} />
<ScanBarcodeIcon size={34} color="darkGrey" />
</Button>
</View>
{recordList.map(({ name, quantity, unit, id }) => (
Expand Down
4 changes: 4 additions & 0 deletions native/screens/NewStockScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export function NewStockScreen({ navigation }: NewStockScreenProps) {
}, [isError]);

const onSubmit = (data: CreateInventoryFormValues) => {
if (!isConnected) {
showError("Brak połączenia z internetem");
return;
}
mutate(data);
};

Expand Down

0 comments on commit ffbb4bd

Please sign in to comment.