Closed tamafull closed 2 years ago
できればフォーム右側にエラーメッセージを表示したい サーバー側の応答によって判別するのはできないためクライアント側で入力バリデーションする
なぜかHome画面で405が出てる(APIはsign_in)のでこれも直す
Started GET "/api/v1/home" for ::1 at 2021-12-04 15:53:03 +0900
Processing by Api::V1::HomeController#index as HTML
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms | Allocations: 206)
Started GET "/api/v1/auth/sign_in" for ::1 at 2021-12-04 15:53:03 +0900
Processing by Api::V1::Auth::SessionsController#new as HTML
Completed 405 Method Not Allowed in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 269)
homeで認証失敗してるのはなぜか
devise_groupの使い方が原因っぽい 適当にやってしまった
こっちでやる
axiosのcatchで
こんな風にしたら
が出た これはfunctionだとエラーをthrowしたところのthisを引き継いでいないため なのでこうする
アロー関数を用いることでメソッド内で用いていたthis=Vueインスタンスを参照できるようになる