Add to e2e
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import {useEffect, useState} from 'react'
|
import {useEffect, useState} from 'react'
|
||||||
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAgent} from '#/state/session'
|
import {useAgent} from '#/state/session'
|
||||||
import * as apilib from 'lib/api/index'
|
import * as apilib from 'lib/api/index'
|
||||||
@@ -8,6 +9,7 @@ import {ComposerOpts} from 'state/shell/composer'
|
|||||||
export function useExternalLinkFetch({}: {
|
export function useExternalLinkFetch({}: {
|
||||||
setQuote: (opts: ComposerOpts['quote']) => void
|
setQuote: (opts: ComposerOpts['quote']) => void
|
||||||
}) {
|
}) {
|
||||||
|
const {i18n} = useLingui()
|
||||||
const {getAgent} = useAgent()
|
const {getAgent} = useAgent()
|
||||||
const [extLink, setExtLink] = useState<apilib.ExternalEmbedDraft | undefined>(
|
const [extLink, setExtLink] = useState<apilib.ExternalEmbedDraft | undefined>(
|
||||||
undefined,
|
undefined,
|
||||||
@@ -22,7 +24,7 @@ export function useExternalLinkFetch({}: {
|
|||||||
return cleanup
|
return cleanup
|
||||||
}
|
}
|
||||||
if (!extLink.meta) {
|
if (!extLink.meta) {
|
||||||
getLinkMeta(getAgent(), extLink.uri).then(meta => {
|
getLinkMeta(getAgent(), extLink.uri, 5e3, i18n).then(meta => {
|
||||||
if (aborted) {
|
if (aborted) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -41,7 +43,7 @@ export function useExternalLinkFetch({}: {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
return cleanup
|
return cleanup
|
||||||
}, [extLink, getAgent])
|
}, [extLink, getAgent, i18n])
|
||||||
|
|
||||||
return {extLink, setExtLink}
|
return {extLink, setExtLink}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user