diff --git a/frontend/src/components/CardsTable.tsx b/frontend/src/components/CardsTable.tsx
index e7b2ec64..e4d84e0c 100644
--- a/frontend/src/components/CardsTable.tsx
+++ b/frontend/src/components/CardsTable.tsx
@@ -197,7 +197,7 @@ export const CardsTable = ({
)}
- |
diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx
index 6ae6c473..272f6e76 100644
--- a/frontend/src/main.tsx
+++ b/frontend/src/main.tsx
@@ -56,11 +56,11 @@ const router = createBrowserRouter([
element: ,
},
{
- path: '/cards/detail',
+ path: '/cards/detail/:id',
element: ,
},
{
- path: '/cards/settings',
+ path: '/cards/:id/settings',
element: ,
},
]);
diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx
index e355c1f9..a2f9ba43 100644
--- a/frontend/src/pages/Login.tsx
+++ b/frontend/src/pages/Login.tsx
@@ -3,7 +3,10 @@ import {
Box,
Button,
Container,
- Flex,
+ Alert,
+ AlertIcon,
+ AlertTitle,
+ AlertDescription,
FormControl,
FormLabel,
Heading,
@@ -53,6 +56,7 @@ export const LoginPage = () => {
const [city, setCity] = useState('Berlin');
const [countryCode, setCountryCode] = useState('DE');
const [poBox, setPoBox] = useState('10212');
+ const [errors, setErrors] = useState([]);
useEffect(() => {
if (accessToken !== '') {
@@ -119,19 +123,32 @@ export const LoginPage = () => {
};
const signUp = async (data: any) => {
- const res = await api.post('/user', JSON.stringify(data));
- console.log(res);
- const user = await res.data;
- console.log(user);
- console.log(res.status);
- console.log(res);
+ try {
+ const res = await api.post('/user', JSON.stringify(data));
+ if (res?.response.data.statusCode === 400) {
+ setErrors(res?.response.data.message)
+ } else if(res?.response.data.statusCode === 201){
+ const user = await res?.data;
+ console.log(user);
+ console.log(res?.status);
+ } else {
+ setErrors(["The error is from our end... We're trying to resolve it as soon as possible"])
+ }
+ } catch(e) {
+ console.log(e);
+ }
};
+ console.log(typeof(errors));
+
+
+
return (
<>
{
+ {
+ errors.length > 0 &&
+
+
+ {/* Error! */}
+
+ {Array.isArray(errors) ? (
+ // Render multiple messages
+
+ {errors.map((msg, index) => (
+ {msg}
+ ))}
+
+ ) : (
+ // Render a single message
+ {errors}
+ )}
+
+
+ }