fix: 🐛 Clear specific keys instead of erasing the entire cache
This commit is contained in:
parent
2b99a64730
commit
9e83d8a0f2
|
@ -1,5 +1,3 @@
|
|||
import AsyncStorage from '@react-native-async-storage/async-storage'
|
||||
|
||||
import { useApi, useChildList } from '@skolplattformen/api-hooks'
|
||||
import { Child } from '@skolplattformen/embedded-api'
|
||||
import {
|
||||
|
@ -24,6 +22,7 @@ import {
|
|||
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
||||
import ActionSheet from 'rn-actionsheet-module'
|
||||
import { Colors, Layout as LayoutStyle, Sizing, Typography } from '../styles'
|
||||
import { clearCache } from '../utils/cache'
|
||||
import { translate } from '../utils/translation'
|
||||
import { ChildListItem } from './childListItem.component'
|
||||
import { SettingsIcon } from './icon.component'
|
||||
|
@ -66,7 +65,7 @@ export const Children = () => {
|
|||
|
||||
const logout = () => {
|
||||
api.logout()
|
||||
AsyncStorage.clear()
|
||||
clearCache()
|
||||
}
|
||||
|
||||
// We need to skip safe area view here, due to the reason that it's adding a white border
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import AsyncStorage from '@react-native-async-storage/async-storage'
|
||||
|
||||
export const keys: Array<string> = ['ssn']
|
||||
|
||||
export const clearCache = () => {
|
||||
AsyncStorage.multiRemove(keys)
|
||||
}
|
Loading…
Reference in New Issue