set date
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import {useServiceConfigQuery} from '#/state/queries/email-verification-required'
|
import {useServiceConfigQuery} from '#/state/queries/email-verification-required'
|
||||||
|
import {useProfileQuery} from '#/state/queries/profile'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {BSKY_SERVICE} from '../constants'
|
import {BSKY_SERVICE} from '../constants'
|
||||||
import {getHostnameFromUrl} from '../strings/url-helpers'
|
import {getHostnameFromUrl} from '../strings/url-helpers'
|
||||||
@@ -7,16 +8,26 @@ export function useEmail() {
|
|||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
|
|
||||||
const {data: serviceConfig} = useServiceConfigQuery()
|
const {data: serviceConfig} = useServiceConfigQuery()
|
||||||
|
const {data: profile} = useProfileQuery({did: currentAccount?.did})
|
||||||
|
|
||||||
const checkEmailConfirmed = serviceConfig?.checkEmailConfirmed
|
const checkEmailConfirmed = serviceConfig?.checkEmailConfirmed
|
||||||
|
|
||||||
|
console.log(profile?.createdAt)
|
||||||
|
|
||||||
|
const isNewEnough =
|
||||||
|
profile?.createdAt &&
|
||||||
|
Date.parse(profile.createdAt) >= Date.parse('2024-11-16T02:00:00.000Z')
|
||||||
|
|
||||||
const isSelfHost =
|
const isSelfHost =
|
||||||
currentAccount &&
|
currentAccount &&
|
||||||
getHostnameFromUrl(currentAccount.service) !==
|
getHostnameFromUrl(currentAccount.service) !==
|
||||||
getHostnameFromUrl(BSKY_SERVICE)
|
getHostnameFromUrl(BSKY_SERVICE)
|
||||||
|
|
||||||
const needsEmailVerification =
|
const needsEmailVerification =
|
||||||
!isSelfHost && checkEmailConfirmed && !currentAccount?.emailConfirmed
|
!isSelfHost &&
|
||||||
|
checkEmailConfirmed &&
|
||||||
|
!currentAccount?.emailConfirmed &&
|
||||||
|
isNewEnough
|
||||||
|
|
||||||
return {needsEmailVerification}
|
return {needsEmailVerification}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user