-1
Well, every time I Reload in my application or open and close it, I have to put the login and password, it could be some error in my code, could someone take a look? 'Cause I need when I open do Reload no need to enter password and email.
import axios from 'axios';
import { AsyncStorage } from 'react-native';
const api = axios.create({
baseURL: 'http://10.0.3.2:3333/',
});
api.interceptors.request.use(async (config) => {
try {
const token = await AsyncStorage.getItem('@App:token');
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
} catch (err) {
alert(err);
}
});
export default api;
Will Asyncstore be removed from React-Native? From now on you will have to use libraries?
– Cassio C Santana
Yes, it will be replaced by the repository at https://github.com/react-native-community/react-native-async-storage
– Murilo Medeiros