Skip to content

Conversation

@BVPritesh
Copy link
Owner

No description provided.

src/App.tsx Outdated
@@ -0,0 +1,58 @@
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import DefaultLayout from "./layouts/DefaultLayout";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Tsconfig alias Import statements Missing

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

src/App.tsx Outdated
import Dashboard from "./pages/admin/dashboard";
import { AuthProvider } from "./contexts/AuthContext";

const router = createBrowserRouter([
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Routing should be defined in separate file

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

src/App.tsx Outdated
},
]);

function App() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Make all function name as per ES6 Standard

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

@@ -0,0 +1,7 @@
export default function Footer() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Define function type like : ReactElement

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

const { isAuthenticated, logout } = useAuth();
const navigate = useNavigate();

const [menuOpen, SetMenuOpen] = useState(false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh State should be define with type

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

};

useEffect(() => {
function handleResize() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Function should be define outside of the useEffect

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

logout: () => void;
};

const AuthContext = createContext<AuthContextType | undefined>(undefined);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Context type define initial value as a null instead of undefined and always prefer default value null instead of undefined

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

headers["Authorization"] = `Bearer ${token}`;
}

const res = await fetch("https://jsonplaceholder.typicode.com/posts", {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Define api end point domain in environment file and api end points like post, create define in constant file

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

}

const data: Post[] = await res.json();
if (mounted) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Unwanted used of mounted variable remove it and adjust your logic

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

}, [token]);

// Validation rules
const titleRegex = /^[A-Za-z\s]+$/; // letters and spaces only
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Validation rules should be define in separate file

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

return Object.keys(errors).length === 0;
}

function showToast(message: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Create a common hook to show and hide the toaster message

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

setTitle("");
setBody("");
setFormErrors({});
setEditingId(null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BVPritesh Create a separate function to reset the value

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants