hiteshchoudhary / ama-app Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://truefeedback.in
Home Page: https://truefeedback.in
Heres the complete corrected code :
https://gist.github.com/career-tokens/024d57156d774259d9e8aedbaf8c7646
if (!user || user.length === 0) {
return Response.json(
{ success: false, message: 'User not found', },
{ status: 404 }
);
}
here checking length of message is after aggregation pipeline
is creating error user-not found for new user
MessageCard.tsx has a TS type error for line number 40 -
onMessageDelete(message._id);
Argument of type 'unknown' is not assignable to parameter of type 'string'.ts(2345)
onMessageDelete(message._id as string);
there needs to be some changes in suggest-messages as openaistream has been depritiated also
vercel has removed some of the providers and updated whole document
Description: Currently, users are able to click the sign-in button multiple times without entering any credentials. This results in multiple requests being sent to the backend, potentially causing unnecessary load and processing.
Steps to Reproduce:
Expected Behavior:
Users should only be able to submit the sign-in form once, and subsequent clicks on the sign-in button without entering credentials should not trigger additional requests.
Proposed Solution:
Implement client-side validation to disable the sign-in button until valid credentials are entered. This can help prevent multiple requests from being sent unintentionally. Additionally, consider adding visual feedback to indicate to the user that the sign-in process is underway.
My views:
As observed, the sign-in button remains active even if no credentials are entered. To address this, we can utilize React's useState hook to disable the button upon submission. By setting a state variable to track the submission status, we can prevent multiple submissions. Additionally, considering the usage of react-hook-form, we can leverage its formState.isDirty property to conditionally disable the button until valid credentials are entered.
in the signup route
if (existingUserByEmail) {
if (existingUserByEmail.isVerified) {
return Response.json(
{
success: false,
message: 'User already exists with this email',
},
{ status: 400 }
);
} else {
const hashedPassword = await bcrypt.hash(password, 10);
existingUserByEmail.password = hashedPassword;
existingUserByEmail.verifyCode = verifyCode;
existingUserByEmail.verifyCodeExpiry = new Date(Date.now() + 3600000);
await existingUserByEmail.save();
}
}
here changed the user info but not the username when the user is not verified so when we verify it the username is not found message occurred
so the user stuck the situation where not able to signup with same email when he is not verified
here we had two solutions
I am getting a run time error where it says the NextRouter is not mounted.
For the file at app\api\sign-up\route.ts
,
There is an update line missing where an user ,whose entry is already there for having the same mail, enters a different username. It will cause problem since the verify page is based on username and that username would not be present though the entry is there.
Heres the github gist for the complete code for that page:
https://gist.github.com/career-tokens/14212eaa38809684838279f2ed64ab6d
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.