我有一個(gè) node.js 和 Ionic (angular) 應(yīng)用程序,當(dāng)我嘗試從我的手機(jī)進(jìn)行 API 調(diào)用時(shí),我收到了這個(gè)錯(cuò)誤 -> object XMLHttpRequestProgressEvent我正在像這樣服務(wù)我的 Ionic 應(yīng)用程序ionic serve --address=10.0.0.107。它不適用于來(lái)自客戶(hù)端的每個(gè)電話(huà)僅在電話(huà)上,當(dāng)我從桌面撥打電話(huà)時(shí),一切都很好。這是來(lái)自 auth.service.ts 的登錄部分 loginUser(u: User): Observable<any> { const url = `${this.baseUrl}/auth`; const body = { username: u.username, password: u.password }; // When you want to send a cookies with requests, // you have to put "withCredentials: true" into request option return this.http.post(url, body, this.noAuthOptions); }這是我的選擇: private readonly baseUrl = "http://localhost:3000"; private readonly contentType = { "Content-Type": "application/json" }; private readonly noAuth = { "No-Auth": "True" }; private readonly header = new HttpHeaders(this.contentType); private readonly noAuthHeader = new HttpHeaders({ ...this.contentType, ...this.noAuth }); private readonly options = { headers: this.header, withCredentials: true }; private readonly noAuthOptions = { headers: this.noAuthHeader, withCredentials: true };這是我在 github 上的代碼(前端)https://github.com/TenPetr/dashboard 和后端部分:https ://github.com/TenPetr/dashboard_backend你有什么想法,為什么會(huì)這樣?
移動(dòng)設(shè)備上的對(duì)象 XMLHttpRequestProgressEvent 錯(cuò)誤
暮色呼如
2022-01-13 20:01:53