1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Erroe】The POST method is not supported for route

Posted at

バージョン

Laravel9
Inertia
Vue3

エラー

The POST method is not supported for route admin/purchases/store. Supported methods: GET, HEAD, PUT, PATCH, DELETE.

上記のエラーが表示されました。

ルート

Route::resource('purchases', PurchaseController::class)
->middleware(['auth:admins', 'verified']);

ルートはresourceで一括で指定しており、コマンドで確認してもちゃんと通っているので問題ありませんでした。

image.png

原因

Vue側に問題がありました。

修正前

const storePurchase = () => {
    Inertia.post('/admin/purchases/store', form)
}

修正後

const storePurchase = () => {
    Inertia.post('/admin/purchases', form)
}

これで解決できました。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?