-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
We found an error in production. When logging in to the console, the following occurs:
Uncaught (in promise) null
After going through the call stack with a debugger, I ended up with this methods, which is part of this module:
async request(t, i={}) {
const n = typeof i == "object" ? Object.assign({}, i, t) : t;
return n.baseURL === "" && (n.baseURL = zj()),
this.ctx.$http ? this.ctx.$http.raw(n).catch(o => (this.callOnError(o, {
method: "request"
}),
Promise.reject(o))) : Promise.reject(new Error("[AUTH] add the @nuxt-alt/http module to nuxt.config file"))
}
async raw(t, i) {
return typeof t == "string" ? this.request(t, {
...i,
raw: !0
}) : this.request({
...t,
raw: !0
})
}
async request(t, i) {
typeof t == "string" ? (i = i || {},
i.url = t) : i = t,
i = gd(i, So(this, ws)),
i.method = i.method ? i.method.toUpperCase() : "GET",
/^https?/.test(i.url) && delete i.baseURL;
const n = [];
let r = !0;
this.interceptors.request.forEach(v => {
typeof v.runWhen == "function" && v.runWhen(i) === !1 || (r = r && v.synchronous,
n.unshift(v.onFulfilled, v.onRejected))
}
);
const o = [];
this.interceptors.response.forEach(v => {
o.push(v.onFulfilled, v.onRejected)
}
);
let l, h = 0, d;
if (!r) {
const v = [Ch(this, Xg, Eb).bind(this), void 0];
for (v.unshift.apply(v, n),
v.push.apply(v, o),
d = v.length,
l = Promise.resolve(i); h < d; )
l = l.then(v[h++], v[h++]);
return l
}
d = n.length;
let _ = i;
for (h = 0; h < d; ) {
const v = n[h++]
, x = n[h++];
try {
_ = await (v == null ? void 0 : v(_))
} catch (T) {
x == null || x.call(this, T);
break
}
}
try {
l = Ch(this, Xg, Eb).call(this, _)
} catch (v) {
return Promise.reject(v)
}
for (h = 0,
d = o.length; h < d; )
l = l.then(o[h++], o[h++]);
return l
}The error occurs absolutely regardless of the result - whether it is 200 ok for /login or 400 bad request - it is thrown to the console anyway.
Metadata
Metadata
Assignees
Labels
No labels