为什么显示请求失败,状态码为401?

时间:2019-10-01 14:51:45

标签: nuxt nuxtserverinit

我正在使用axios在Nuxt服务器init中获取数据,请求失败,状态码为401,并且createError

        await $axios
            .get("/shopping/get-wishlist")
            .then(response => {
                commit('setWishlist', response.data.payload.wishlist)
            })
            .catch(error => {
                console.log(error);
            });
        await $axios
            .get("/shopping/get-cart")
            .then(response => {
                commit('setBasketList', response.data.payload.cart.items)
            })
            .catch(err => {
                console.log(err);
            });

    }, ```

```at createError (node_modules\axios\lib\core\createError.js:16:15)```

0 个答案:

没有答案