fixed a bad merge

This commit is contained in:
Christian Landgren 2020-12-22 04:44:49 +01:00
parent 1181fe2505
commit b8c3db14c1
3 changed files with 4 additions and 16 deletions

View File

@ -1,6 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
production: {
plugins: ["transform-remove-console"]
}
presets: ['module:metro-react-native-babel-preset']
};

View File

@ -1,5 +1,6 @@
import React, {useState, useMemo, useCallback, useEffect } from 'react'
import { StyleSheet, View, Image } from 'react-native'
import { useFocusEffect } from '@react-navigation/native'
import { SafeAreaView } from 'react-native'
import useFetch from 'use-http'
import moment from 'moment'
@ -37,7 +38,7 @@ const fake = fullChildren => fullChildren.map(child => ({
export const Children = ({navigation}) => {
const [children, setChildren] = useAsyncStorage('@children', [])
useEffect(() => {
useFocusEffect(() => {
const load = async () => {
try {
const childrenList = children?.length || await api.getChildren()

View File

@ -22,16 +22,6 @@ export const Login = ({ navigation, route }) => {
useEffect(() => {
setValid(Personnummer.valid(socialSecurityNumber))
const url = Platform.OS == 'ios' ? 'https://app.bankid.com/' : 'bankid:///'
setHasBankId(Linking.canOpenURL(url))
if (route.params?.error) setError(route.params.error)
console.log('effect')
if (cookie) {
console.log('cookie', cookie)
api.setSessionCookie(cookie)
setLoggedIn(true)
navigateToChildren()
}
}, [socialSecurityNumber, cookie])
useEffect(() => {
@ -88,9 +78,9 @@ export const Login = ({ navigation, route }) => {
loginStatus.on("ERROR", () => setError('Inloggningen misslyckades, försök igen!') && setVisible(false))
loginStatus.on("OK", async () => {
setLoggedIn(true)
navigateToChildren()
const session = api.getSessionCookie()
setCookie(session)
navigateToChildren()
setVisible(false)
})
}