diff --git a/src/App.tsx b/src/App.tsx index 0bc7a0035..55d20f58f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -27,7 +27,7 @@ export const App = () => { const fetchedUsers = await client.get('/users'); if (fetchedUsers.length === 0) { - throw new Error('No users found'); + throw new Error('No users found. Please try a different search.'); } setUsers(fetchedUsers); @@ -46,7 +46,7 @@ export const App = () => { setPosts(fetchedPosts); } catch (err) { - setError('Failed to load posts'); + setError('Failed to load posts due to network issues'); } finally { setIsLoading(false); } @@ -131,4 +131,4 @@ export const App = () => { ); -}; \ No newline at end of file +}; diff --git a/src/components/NewCommentForm.tsx b/src/components/NewCommentForm.tsx index b520c3286..b2c03952c 100644 --- a/src/components/NewCommentForm.tsx +++ b/src/components/NewCommentForm.tsx @@ -52,9 +52,9 @@ export const NewCommentForm: React.FC = ({ setNameError('Name is required'); } - if (!trimmedEmail) { + if (!trimmedEmail.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) { hasValidationErrors = true; - setEmailError('Email is required'); + setEmailError('Invalid email format'); } if (!trimmedText) { @@ -208,4 +208,4 @@ export const NewCommentForm: React.FC = ({ ); -}; \ No newline at end of file +}; diff --git a/src/components/PostDetails.tsx b/src/components/PostDetails.tsx index 2211d3f5f..b194da4b6 100644 --- a/src/components/PostDetails.tsx +++ b/src/components/PostDetails.tsx @@ -120,4 +120,4 @@ export const PostDetails: React.FC = ({ post }) => { ); -}; \ No newline at end of file +}; diff --git a/src/components/PostsList.tsx b/src/components/PostsList.tsx index d70d79dd7..595fb8954 100644 --- a/src/components/PostsList.tsx +++ b/src/components/PostsList.tsx @@ -47,4 +47,4 @@ export const PostsList: React.FC = ({ posts, openedPost, onOpen }) => ( -); \ No newline at end of file +); diff --git a/src/components/UserSelector.tsx b/src/components/UserSelector.tsx index dae2a5ee1..e715a0b48 100644 --- a/src/components/UserSelector.tsx +++ b/src/components/UserSelector.tsx @@ -72,4 +72,4 @@ export const UserSelector: React.FC = ({ ); -}; \ No newline at end of file +}; diff --git a/src/types/Post.ts b/src/types/Post.ts index 6cd1dce94..9f4fe2029 100644 --- a/src/types/Post.ts +++ b/src/types/Post.ts @@ -4,4 +4,3 @@ export interface Post { title: string; body: string; } - diff --git a/src/types/User.ts b/src/types/User.ts index f86d7259a..d0e2c8483 100644 --- a/src/types/User.ts +++ b/src/types/User.ts @@ -1,4 +1,4 @@ -import { Post } from "./Post"; +import { Post } from './Post'; export interface User { id: number;