mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-28 20:00:10 +02:00

* Pull email context outside of `ResendConfirmationCodeModal` * Use `loading` prop of button instead of deprecated Icon * Swap notification order to clarify priority (no change in behaviour) * Replace confirmation link action by confirmationCodeModal, and simplify code * Change to secondary button variant in the Notification * Display errors within the modal * Increase ratelimit for resend-confirmation * Copy changes * Add stories on email confirmation notifications * Fix other Notification stories * Update tests * Update services/web/frontend/js/features/settings/components/emails/confirm-email-form.tsx Co-authored-by: Rebeka Dekany <50901361+rebekadekany@users.noreply.github.com> * Remove placeholder on 6-digit code input --------- Co-authored-by: Rebeka Dekany <50901361+rebekadekany@users.noreply.github.com> GitOrigin-RevId: dad8bfd79505a2e7d065fd48791fd57c8a31e071
20 lines
473 B
TypeScript
20 lines
473 B
TypeScript
import { useLayoutEffect } from 'react'
|
|
import fetchMock from 'fetch-mock'
|
|
|
|
/**
|
|
* Run callback to mock fetch routes, call removeRoutes() and unmockGlobal() when unmounted
|
|
*/
|
|
export default function useFetchMock(
|
|
callback: (value: typeof fetchMock) => void
|
|
) {
|
|
fetchMock.mockGlobal()
|
|
|
|
useLayoutEffect(() => {
|
|
fetchMock.mockGlobal()
|
|
callback(fetchMock)
|
|
return () => {
|
|
fetchMock.removeRoutes()
|
|
fetchMock.unmockGlobal()
|
|
}
|
|
}, [callback])
|
|
}
|