save code when it's there
This commit is contained in:
parent
bf07b6da4f
commit
f7558f3c93
2 changed files with 21 additions and 1 deletions
14
src/hooks/useSaveSignupCodeToLocalStorage.ts
Normal file
14
src/hooks/useSaveSignupCodeToLocalStorage.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { useSearchParams } from 'react-router-dom'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export function useSaveSignupCodeToLocalStorage() {
|
||||
const [searchParams] = useSearchParams()
|
||||
|
||||
const code = searchParams.get('ck')
|
||||
|
||||
useEffect(() => {
|
||||
if (code) {
|
||||
localStorage.setItem('signupCode', code)
|
||||
}
|
||||
}, [code])
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue