Unable to solve this error in my code
Unanswered
Whiteleg shrimp posted this in #help-forum
Whiteleg shrimpOP
Uncaught Error: There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.
Uncaught TypeError: Cannot read properties of undefined (reading 'User')
https://github.com/ghostbadfame/SmallBig
Can anyone helpme with this code i have a submission today
Uncaught TypeError: Cannot read properties of undefined (reading 'User')
https://github.com/ghostbadfame/SmallBig
Can anyone helpme with this code i have a submission today
13 Replies
Hermit Thrush
send some code
Whiteleg shrimpOP
import mongoose, { Schema } from 'mongoose';
const userSchema = new Schema({
name: {
required: [true, "Name field is required."],
minLength: [2, "Name must be at least 2 characters long."],
type: Schema.Types.String,
},
email: {
required: [true, "Email field is required."],
type: Schema.Types.String,
unique: true,
trim: true,
},
password: {
type: Schema.Types.String,
},
password_reset_token: {
type: Schema.Types.String,
trim: true,
},
}, { timestamps: true });
export const User = mongoose.models.User || mongoose.model("User", userSchema);
const userSchema = new Schema({
name: {
required: [true, "Name field is required."],
minLength: [2, "Name must be at least 2 characters long."],
type: Schema.Types.String,
},
email: {
required: [true, "Email field is required."],
type: Schema.Types.String,
unique: true,
trim: true,
},
password: {
type: Schema.Types.String,
},
password_reset_token: {
type: Schema.Types.String,
trim: true,
},
}, { timestamps: true });
export const User = mongoose.models.User || mongoose.model("User", userSchema);
this is my model code for User
this is github repo
Hermit Thrush
i have to clone it and see
Whiteleg shrimpOP
do you want credentials also
it will save your time too
Hermit Thrush
yes
Whiteleg shrimpOP
check dm
can you please pull it again from github
i updated the code removing some bugs
@Hermit Thrush