ordering-ui-react-native 0.14.73 → 0.14.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ import { _clearStoreData, _retrieveStoreData } from '../../../../../src/provider
|
|
|
9
9
|
const LogoutButtonUI = (props: any) => {
|
|
10
10
|
const { handleLogoutClick, formState, ButtonUI } = props
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const theme = useTheme();
|
|
13
13
|
const [, { setStateValues }] = useOrder();
|
|
14
14
|
const [, { showToast }] = useToast();
|
|
15
15
|
const [, t] = useLanguage();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Modal } from 'react-native';
|
|
3
|
-
import { useLanguage, LogoutAction, useApi, useSession } from 'ordering-components/native';
|
|
4
|
-
|
|
3
|
+
import { useLanguage, LogoutAction, useApi, useSession, useBusiness, useOrder } from 'ordering-components/native';
|
|
5
4
|
import { useForm, Controller } from 'react-hook-form';
|
|
6
5
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
6
|
+
import { useTheme } from 'styled-components/native';
|
|
7
7
|
|
|
8
8
|
import NavBar from '../NavBar';
|
|
9
9
|
import { OSBody, OSContainer, OSContent } from './styles';
|
|
10
10
|
import { OButton, OInput, OText } from '../shared';
|
|
11
11
|
import { useDeviceOrientation, PORTRAIT } from '../../../../../src/hooks/DeviceOrientation';
|
|
12
|
-
import {
|
|
12
|
+
import { _clearStoreData, _retrieveStoreData } from '../../../../../src/providers/StoreUtil'
|
|
13
13
|
|
|
14
14
|
const LogoutPopupUI = (props: Props) => {
|
|
15
15
|
const {
|
|
@@ -19,13 +19,15 @@ const LogoutPopupUI = (props: Props) => {
|
|
|
19
19
|
} = props;
|
|
20
20
|
|
|
21
21
|
const theme = useTheme();
|
|
22
|
+
const [, { setStateValues }] = useOrder();
|
|
22
23
|
const [ordering] = useApi();
|
|
23
24
|
const [{ token }] = useSession();
|
|
24
25
|
const [, t] = useLanguage();
|
|
26
|
+
const [, { setBusiness }] = useBusiness();
|
|
25
27
|
const [orientationState] = useDeviceOrientation();
|
|
26
28
|
const { control, handleSubmit, errors } = useForm();
|
|
27
29
|
const [passwordSee, setPasswordSee] = useState(false);
|
|
28
|
-
const [logoutState, setLogoutState] = useState({ loading: false, error: false, result: [] })
|
|
30
|
+
const [logoutState, setLogoutState] = useState<any>({ loading: false, error: false, result: [] })
|
|
29
31
|
|
|
30
32
|
const fetchPassword = async (body: any) => {
|
|
31
33
|
try {
|
|
@@ -43,12 +45,12 @@ const LogoutPopupUI = (props: Props) => {
|
|
|
43
45
|
result
|
|
44
46
|
})
|
|
45
47
|
return { error, result }
|
|
46
|
-
} catch (e) {
|
|
48
|
+
} catch (e: any) {
|
|
47
49
|
setLogoutState({
|
|
48
50
|
...logoutState,
|
|
49
51
|
loading: false,
|
|
50
52
|
error: true,
|
|
51
|
-
result: e
|
|
53
|
+
result: [e?.message]
|
|
52
54
|
})
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -56,7 +58,17 @@ const LogoutPopupUI = (props: Props) => {
|
|
|
56
58
|
const onSubmit = async (values: any) => {
|
|
57
59
|
const result = await fetchPassword(values)
|
|
58
60
|
if (result?.result === 'OK') {
|
|
59
|
-
handleLogoutClick();
|
|
61
|
+
const res: any = await handleLogoutClick();
|
|
62
|
+
if (res) {
|
|
63
|
+
_clearStoreData({ excludedKeys: ['isTutorial'] })
|
|
64
|
+
setBusiness({})
|
|
65
|
+
setStateValues({
|
|
66
|
+
options: {
|
|
67
|
+
moment: null
|
|
68
|
+
},
|
|
69
|
+
carts: {},
|
|
70
|
+
})
|
|
71
|
+
}
|
|
60
72
|
onClose();
|
|
61
73
|
}
|
|
62
74
|
}
|