問題タブ [axios]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - React Router を使用した ReactJS - Chrome での奇妙なルーティング動作
これは少し奇妙で、その真相を突き止めたいと思います。
ユーザーがメールアドレスを入力してボタンをクリックすると、「サインアップしました!」と表示されるページがあります。メッセージ - シンプル。
そのために、私は2つのルートを持っています。メインルートと「サインアップ」ルート。
最初のページで、ユーザーが電子メール アドレスを入力してボタンをクリックすると、POST AJAX を起動してバックエンド DB (Axios パッケージを使用) に電子メール アドレスを保存し、完了したら「サインアップ」ルートに移動します。 .
ここで、最初に自分のページの URL を入力すると
ブラウザ (Chrome、FireFox、Safari) はすべて、URL を次のように変更しているようです。
けっこうだ。FireFox で、メールを入力して送信ボタンをクリックすると、すべてうまく機能し、
ただし、Chrome では、送信をクリックしてもルートは変更されません。実際、開発者コンソールにエラーが表示されます。
まず、「投稿」リクエストがキャンセルされたのはなぜですか?次に、これが発生すると、Chrome が応答しなくなります。ページを更新すると、Chrome の「ネイビー スクリーン デス」が表示されます。
さて、おかしなことに、最初の URL を
(ハッシュの前に疑問符を挿入)、Chrome で問題なく動作します。だから、ルートパスやパラメータと関係があるのだろうかと思います。
何か案は?
javascript - コールバックが axios ライブラリで機能しないのはなぜですか?
axios
http
ライブラリを使用するために変換しようとしている小さな Spotify アプリがあります。ログイン時のコールバックに問題があります。これまで、すべてのドキュメントrequest
で like is を使用してきました。Spotify
すべてが で正常に動作しrequest
ますが、すべてが で同じように見えますがaxios
、500 Internal Server Error
. http
リクエストを行うための私のコードは次のとおりです。
authOptions
同じオブジェクトをrequest
ライブラリに渡すことができ、すべて正常に動作します。axios
コンソールにログアウトしてからの私のリクエストは次のとおりです。
そして、これがaxios
ライブラリに対する私の応答です。
from について私が知らなかった唯一のオプションaxios
は、またはwithCredentials
に設定されている場合は機能しませんでした。他に何が欠けていますか?false
true
javascript - Axios 配列マップ コールバック
反応した ES6 アプリでは、次のことを行う必要があります。ある組織の git ハブ メンバーのリストを取得し、その後、それぞれの情報の詳細を取得します。
コード:
マップが完了した後、どのようにsetStateを設定できますか?
node.js - axios を使用して React/Phoenix アプリで API 呼び出しを行おうとしています (Brunch を使用)
axiosライブラリを利用して、いくつかの API エンドポイントを呼び出そうとしています。
私のプロジェクトのセットアップは、Phoenix アプリ (アセット管理用のブランチ付き) と React アプリ (すべてweb/static/js
ディレクトリ内)です。
ほとんどの npm モジュールは問題ありません。
npm install --save _module-name_
次に、モジュールを配列に追加しbrunch-config.js
ますnpm whitelist
。
私は axios でこれを行ったので、ライブラリが見つからないと不平を言うことはありません。
ただし、axiosを使用しようとするとaxios.post
JS コンソールに次のエラーが表示されます。
Cannot find module "axios/lib/adapters/xhr"
ブランチがaxiosの依存関係にロードされていないようです(ナビゲートするとそのファイルを見ることができますが)node_modules/axios/lib/adapters
誰かがこの問題を抱えていましたか (npm モジュールとブランチ/フェニックスで)、もしそうなら、どのように修正しますか?
アップデート
ブランチの問題は、より広範囲に広がっているようです。
「React-Bootstrap」も使用できません。サブ依存関係が見つからないという同様のエラーが発生します....
javascript - Blockcypher で raw トランザクションをブロードキャストすると、POST 要求でエラーが発生する
Blockcypher API でブロードキャストしたい生のビットコイン トランザクションがあります。axios を使用して POST リクエストを送信しています。
ターミナルでこれを実行すると、エラーが発生します。
私のPOSTの何が問題なのですか?「tx」の代わりに tx で投稿しようとしましたが、それでも機能しません。ドキュメントでは、次のようにすることを提案しています。
しかし、私がそれをすると、エラーが発生します:
したがって、少なくともBlockcypherから応答が返ってくるので、axiosを使用する方が簡単だと思います。どんな助けでも本当に感謝します!
node.js - Axios get request timeout gets swallowed (Promise)
I have been working on this data gathering module, that is supposed to get data from different bitcoin markets and standardise all the received data so it can be inserted into a mongodb database for later use. (The module is written in node 4.3.x)
The problem I have is that I need consistency in how the data is represented in the database. So whenever a request times out, instead of catching the get request and log an error, I want to resolve a '0'. Additionally the received data contains trades that need to be cut in order. This needs to happen so that the trades can be cut properly, so data is not written twice. For that I have implemented two queues:
1: TimestampQueue - holds timestamps. The timestamp in [0] is the next expected response
2: objectQueue - holds received responses
=> as soon as the object in objectQueue[0] equals the timestamp in timestampQueue[0] => do data manipulation and insert into database.
The problem lies that the axios.get request that should catch a timeout doesn't do that consistently.
It happens after random timeframes, but on average the queue gets stuck after 2hrs.
To make things clearer here some important code snippets: httpclient making the axios request:
Now the marketHandler that resolves the request:
The code that makes the requests for all defined markets (for one method) and joins them in one object:
The code that makes the requests for all methods and markets and joins them in the final object that gets manipulated from a different module and inserted into the database:
I have tested the whole process without any data manipulation. Only those functions and inserting it into the database.
The implementation of the 2 queues:
I have been trying to fix this problem for more than 3 weeks now, and I am absolutely clueless.
TLDR: Axios get request does not resolve or reject. Even though a timeout of 5000ms is defined in the instance used in the httpClient module.