@campxdev/campx-web-utils 0.1.16 → 0.1.17
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
|
@@ -25,6 +25,11 @@ export type DeviceState = {
|
|
|
25
25
|
isLocationAllowed: boolean;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
type LoginDetails = {
|
|
29
|
+
username: string;
|
|
30
|
+
password: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
28
33
|
const performLogin = async (body: any) => {
|
|
29
34
|
if (!body.latitude || !body.longitude) {
|
|
30
35
|
const response = await fetch(
|
|
@@ -104,7 +109,7 @@ export const Login = ({ close }: { close: () => void }) => {
|
|
|
104
109
|
handleSubmit,
|
|
105
110
|
control,
|
|
106
111
|
formState: { errors },
|
|
107
|
-
} = useForm({ resolver: yupResolver(validationSchema) });
|
|
112
|
+
} = useForm<LoginDetails>({ resolver: yupResolver(validationSchema) });
|
|
108
113
|
|
|
109
114
|
const { mutate, isLoading } = useMutation(performLogin, {
|
|
110
115
|
onSuccess(data) {
|
|
@@ -120,7 +125,8 @@ export const Login = ({ close }: { close: () => void }) => {
|
|
|
120
125
|
}
|
|
121
126
|
},
|
|
122
127
|
});
|
|
123
|
-
|
|
128
|
+
|
|
129
|
+
const onSubmit = async (body: LoginDetails) => {
|
|
124
130
|
mutate({ ...body, ...deviceState.deviceInformation });
|
|
125
131
|
};
|
|
126
132
|
|