Closed yasuto2002 closed 1 year ago
<script setup lang="ts"> let errorStatus; const { data: myData, error: error }: { data: any; error?: any } = await useFetch( "https://jsonplaceholder.typicode.com/404", { async onResponseError({ response }) { // onResponseError is a "ohmyfetch" method errorStatus = response.status; // assign the error to the declared variable "errorStatus" }, } ); return { myData, error, errorStatus }; // returning all the variables </script>
https://github.com/nuxt/nuxt/issues/12885
エラーコードを判定