Rebase on master and fixes for typescript

This commit is contained in:
Andreas Eriksson 2021-04-01 21:04:10 +02:00
parent a7186c6f6e
commit 2b28d8c24a
2 changed files with 11 additions and 6 deletions

View File

@ -9,16 +9,21 @@ import { CloseIcon } from './icon.component'
interface ModalWebViewProps {
url: string
sharedCookiesEnabled: boolean
onClose: () => void
}
export const ModalWebView = ({ url, onClose }: ModalWebViewProps) => {
export const ModalWebView = ({
url,
onClose,
sharedCookiesEnabled,
}: ModalWebViewProps) => {
const [modalVisible, setModalVisible] = React.useState(true)
const { api } = useApi()
const [headers, setHeaders] = useState()
useEffect(() => {
const getHeaders = async (urlToGetSessionFor) => {
const getHeaders = async (urlToGetSessionFor: string) => {
if (sharedCookiesEnabled) return
const { headers: newHeaders } = await api.getSession(urlToGetSessionFor)
setHeaders(newHeaders)

View File

@ -19,9 +19,9 @@ export const Notification = ({ item }: NotificationProps) => {
? moment(item.dateCreated).fromNow()
: null
const sharedCookiesEnabled = () => {
return item.url && item.url.startsWith('https://start.unikum.net/')
}
const sharedCookiesEnabled: boolean = Boolean(
item.url && item.url.startsWith('https://start.unikum.net/')
)
return (
<>
@ -45,7 +45,7 @@ export const Notification = ({ item }: NotificationProps) => {
<ModalWebView
url={item.url}
onClose={close}
sharedCookiesEnabled={sharedCookiesEnabled()}
sharedCookiesEnabled={sharedCookiesEnabled}
/>
)}
</>