我正在使用下一个 js 应用程序目录,尝试使用 axios 发布并出错
const submitHandler = async (e) => {
e.preventDefault();
try {
const {data} = await axios.post('/api/register', {
name,
email,
password,
});
console.log(data);
} catch (error) {
console.log(error);
}
};
错误(部分):
error - Error [TypeError]: Cannot read properties of undefined (reading 'prototype')
at eval (webpack-internal:///(sc_server)/./node_modules/mongoose/lib/types/objectid.js:15:36)
at (sc_server)/./node_modules/mongoose/lib/types/objectid.js (/Users/yakovtzur/Documents/Coding/Development/next_13_authjs/.next/server/app/api/register/route.js:2870:1)
at __webpack_require__ (/Users/yakovtzur/Documents/Coding/Development/next_13_authjs/.next/server/webpack-runtime.js:33:43)
at eval (webpack-internal:///(sc_server)/./node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:7:18)
我正在使用下一个 js 应用程序目录,尝试使用 axios 发布