小编Raj*_*sia的帖子

向 api 发送 get 请求时,nextjs geinitialProps 发生 read ECONNRESET 错误

当我在 _app.js 文件的 getInitialPros 中使用 axios 发送 get 请求时,next.js 应用程序中出现此错误。

 if (typeof window === "undefined") {
    // user = await checkAuth(ctx);

    // const token = ctx.req.headers.cookie;

    console.log("TOKEN", ctx.req.headers);

    if (ctx.req && ctx.req.headers.cookie) {
      try {
        res = await axiosClient("get", { cookie: ctx.req.headers.cookie }).get(
          "/auth/currentuser"
        );

        user = res.data;
        console.log("USER IN SERVER SIDE", user);
        ctx.store.dispatch(setAuthenticatedUser(res.data));
      } catch (err) {
        console.log("ERROR in APP", err);
        // console.log("USER FOUND IN APP.JS", res.data);
        ctx.store.dispatch(removeAuthenticatedUser());
      }
    }
  } else {
    try {
      res = await axiosClient("get").get("/auth/currentuser"); …
Run Code Online (Sandbox Code Playgroud)

node.js reactjs axios next.js

9
推荐指数
1
解决办法
6349
查看次数

在颤振中使用 Mixin

我无法在我的 flutter 应用程序中使用 mixin,它说:

类“UserModel”不能用作 mixin,因为它扩展了 Object 以外的类

错误

dart flutter

1
推荐指数
1
解决办法
1530
查看次数

标签 统计

axios ×1

dart ×1

flutter ×1

next.js ×1

node.js ×1

reactjs ×1