@ebubekirylmaz/link-test 1.2.42 → 1.2.43
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import config from "../../config/config";
|
|
2
|
+
import { publish } from "@nucleoidai/react-event";
|
|
2
3
|
import { storage } from "@nucleoidjs/webstorage";
|
|
3
4
|
import { useNavigate } from "react-router-dom";
|
|
4
|
-
import { useSnackbar } from "notistack";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
|
|
7
7
|
import { Button, Stack, TextField, Typography } from "@mui/material";
|
|
@@ -16,7 +16,6 @@ export default function CognitoLogin() {
|
|
|
16
16
|
const [code, setCode] = useState("");
|
|
17
17
|
|
|
18
18
|
const navigate = useNavigate();
|
|
19
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
20
19
|
|
|
21
20
|
const { appId } = config();
|
|
22
21
|
|
|
@@ -50,32 +49,48 @@ export default function CognitoLogin() {
|
|
|
50
49
|
navigate("/");
|
|
51
50
|
} catch (e) {
|
|
52
51
|
console.error("Login error:", e);
|
|
53
|
-
|
|
52
|
+
publish("GLOBAL_MESSAGE_POSTED", {
|
|
53
|
+
status: true,
|
|
54
|
+
message: e.message || "Login failed",
|
|
55
|
+
severity: "error",
|
|
56
|
+
});
|
|
54
57
|
}
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
const handleSignup = async () => {
|
|
58
61
|
try {
|
|
59
62
|
await signup(email, password, password);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
publish("GLOBAL_MESSAGE_POSTED", {
|
|
64
|
+
status: true,
|
|
65
|
+
message:
|
|
66
|
+
"Signup successful! Please check your email for the confirmation code.",
|
|
67
|
+
severity: "success",
|
|
68
|
+
});
|
|
64
69
|
setMode("confirm");
|
|
65
70
|
} catch (e) {
|
|
66
|
-
|
|
71
|
+
publish("GLOBAL_MESSAGE_POSTED", {
|
|
72
|
+
status: true,
|
|
73
|
+
message: e.message || "Signup failed",
|
|
74
|
+
severity: "error",
|
|
75
|
+
});
|
|
67
76
|
}
|
|
68
77
|
};
|
|
69
78
|
|
|
70
79
|
const handleConfirm = async () => {
|
|
71
80
|
try {
|
|
72
81
|
await confirmSignup(email, code);
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
publish("GLOBAL_MESSAGE_POSTED", {
|
|
83
|
+
status: true,
|
|
84
|
+
message: "Account confirmed! You can now log in.",
|
|
85
|
+
severity: "success",
|
|
75
86
|
});
|
|
76
87
|
setMode("login");
|
|
77
88
|
} catch (e) {
|
|
78
|
-
|
|
89
|
+
publish("GLOBAL_MESSAGE_POSTED", {
|
|
90
|
+
status: true,
|
|
91
|
+
message: e.message || "Confirmation failed",
|
|
92
|
+
severity: "error",
|
|
93
|
+
});
|
|
79
94
|
}
|
|
80
95
|
};
|
|
81
96
|
|
|
@@ -96,8 +111,8 @@ export default function CognitoLogin() {
|
|
|
96
111
|
|
|
97
112
|
{mode === "signup" && (
|
|
98
113
|
<TextField
|
|
99
|
-
label="password"
|
|
100
114
|
type="password"
|
|
115
|
+
label="Password"
|
|
101
116
|
value={password}
|
|
102
117
|
onChange={(e) => setPassword(e.target.value)}
|
|
103
118
|
/>
|