|
|
@@ -102,6 +102,7 @@ export const RegionProvider = ({ children }: { children: React.ReactNode }) => {
|
|
|
const handleUpdateSlow = useCallback(
|
|
|
async (id: number, v?: boolean, s11?: boolean, s31?: boolean, s101?: boolean) => {
|
|
|
const updatedSlow: any = {
|
|
|
+ ...userData,
|
|
|
type: 'countries',
|
|
|
visited: true
|
|
|
};
|
|
|
@@ -143,16 +144,21 @@ export const RegionProvider = ({ children }: { children: React.ReactNode }) => {
|
|
|
updatedSlowData.s101 = !visitedValue ? false : s101;
|
|
|
}
|
|
|
|
|
|
- updateSlow(updatedSlowData);
|
|
|
-
|
|
|
- await mutateCountriesData(
|
|
|
- { id, token },
|
|
|
+ updateSlow(updatedSlowData,
|
|
|
{
|
|
|
- onSuccess: (data) => {
|
|
|
- setUserData({ type: 'countries', id, ...data.data });
|
|
|
+ onSuccess: () => {
|
|
|
+ mutateCountriesData(
|
|
|
+ { id, token },
|
|
|
+ {
|
|
|
+ onSuccess: (data) => {
|
|
|
+ setUserData({ type: 'countries', id, ...data.data });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
}
|
|
|
- }
|
|
|
- );
|
|
|
+ });
|
|
|
+
|
|
|
+ updatedSlow && setUserData(updatedSlow);
|
|
|
},
|
|
|
[userData, token]
|
|
|
);
|