) => {
+ event.preventDefault();
+ try {
+ await auth_api.register(email, username, password);
+ setLocalStorageAuth(email);
+ navigate("/");
+ } catch (err) {
+ if (err instanceof Error) {
+ addAlert(err.message, "error");
+ } else {
+ addAlert("Unexpected error.", "error");
+ }
+ }
+ };
+
+ return (
+
+
Register
+ {
+ setEmail(e.target.value);
+ }}
+ value={email}
+ required
+ />
+
+ {
+ setUsername(e.target.value);
+ }}
+ value={username}
+ required
+ />
+ Description:
+ {
+ setPassword(e.target.value);
+ }}
+ value={password}
+ required
+ />
+
+
+
+ );
+};
+
+export default Register;
diff --git a/store/app/crud/users.py b/store/app/crud/users.py
index 403f0f23..9af34f4d 100644
--- a/store/app/crud/users.py
+++ b/store/app/crud/users.py
@@ -14,7 +14,9 @@ class UserCrud(BaseCrud):
async def add_user(self, user: User) -> None:
# Then, add the user object to the Users table.
table = await self.db.Table("Users")
- await table.put_item(Item=user.model_dump(), ConditionExpression="attribute_not_exists(email) AND attribute_not_exists(username)")
+ await table.put_item(
+ Item=user.model_dump(), ConditionExpression="attribute_not_exists(email) AND attribute_not_exists(username)"
+ )
async def get_user(self, user_id: str) -> User | None:
table = await self.db.Table("Users")