clearError
clearError 可組合函式清除所有已處理的錯誤。
在你的頁面、元件和外掛中,你可以使用 clearError
來清除所有錯誤並重定向使用者。
引數
options?: { redirect?: string }
你可以提供一個可選的路徑進行重定向(例如,如果你想導航到一個“安全”頁面)。
// Without redirect
clearError()
// With redirect
clearError({ redirect: '/homepage' })
錯誤透過 useError()
設定在狀態中。clearError
可組合函式將重置此狀態並使用提供的選項呼叫 app:error:cleared
鉤子。