株式会社ヴァンデミックシステム

Blog

<スポンサーリンク>

catchで例外処理

        request
            .post("/getpodstatus", obj)
            // やりたい処理
            .then(request => {
                this.setState({
                    podstatus: request.data.items[0].status.phase
                });
                console.log(this.state.podstatus)
                }
            )

            // エラー時というかやりたい処理ができなかった場合の処理
            .catch(error => {
                this.setState({
                    podstatus: 'Stop'
                });
                console.log('POST失敗時の処理')
            })

 

<スポンサーリンク>

コメントを残す

Allowed tags:  you may use these HTML tags and attributes: <a href="">, <strong>, <em>, <h1>, <h2>, <h3>
Please note:  all comments go through moderation.

*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)