I want to check the Key, if the key exists then I want to set the loggedIn in the initalstate to true. How can I do it? I get no error but my code not working.
import { createSlice } from '@reduxjs/toolkit';
import getSecureKey from '../../../utilies/getSecureKey';
const initialState = {
process: false,
loggedIn: getSecureKey().then(res => res).catch(e => e),
message: '',
error: '',
};
import * as SecureStore from 'expo-secure-store';
const getSecureKey = async () => {
const key = await SecureStore.getItemAsync('jwt');
return key != '' ? true : false
};
export default getSecureKey;