Impressive walkthrough, Mr. DevGeek! Your attention to detail in explaining Redux Toolkit and Redux Persist makes this tutorial a must-watch for React Native enthusiasts.
Thoroughly impressed with the clarity and structure of your Redux Toolkit tutorial. A fantastic resource for anyone diving into React Native development.
Just Subsribed , love the fact that you say inshAllah , May Allah give barakah in this channel , simply awesome way to explain redux toolkit , in a way the even a beginner developer like me can understand. MashAllah
You have to setup this logic where you define your base URL with axios. this interceptor run on every api call import jwtDecode from 'jwt-decode'; export const API = axios.create({ baseURL: '', }); API.interceptors.request.use( async function (config) { // getting access token const {tokens} = store.getState().auth; let {accessToken} = tokens; // decoded token data const decodedToken = jwtDecode(accessToken) // extraction timestamp const expiryTimestamp = new Date(decodedToken.exp * 1000); // checking if token expire if (expiryTimestamp < new Date()) { console.log('token expire'); try { // if token expire get new token const response = await axios.post(`${API_KEY}/user/token`, { refreshToken: tokens.refreshToken, }); console.log('RESPONSE[GET_NEW_TOKEN]', response); if (response?.status === 200) { // getting token from server data const newToken = response?.data?.tokens; // saving new tokens locally storage.set(ASYNC_TOKEN_KEY, JSON.stringify(newToken)); //await AsyncStorage.setItem(ASYNC_TOKEN_KEY, JSON.stringify(newToken)); accessToken = newToken?.accessToken; } // console.debug('Data returned', data); } catch (error) { Toast.show('Token expire unable to get new Token try again later', Toast.LONG); console.log('ERROR[UNABLE_TO_GET_TOKEN]', error); } // injecting our token into header config.headers.Authorization = `Bearer ${accessToken}`; } return config; }, function (error) { return Promise.reject(error); }, );
Roses are red. The skies are blue. The title is in English why aren't you? Change your title as Hindi. Which is quite annoying to see such click bait tutorials out there.
Thank you for your feedback! I understand your concern. While there are many channels that create content in various languages but use English titles, my goal is to reach a broader audience with my tutorials in Urdu. Using English titles helps more people find and benefit from the content. I appreciate your understanding and support!
Hello Sir I Really Need Your Help If user buy a subscription of our react native app so i want to provide them payment slip so how i can implement it please guide me
Impressive walkthrough, Mr. DevGeek! Your attention to detail in explaining Redux Toolkit and Redux Persist makes this tutorial a must-watch for React Native enthusiasts.
Great job! Your explanation was really helpful. Thanks a lot for taking the time to provide such a detailed explanation.
Bhai End kar diya ap ne😍❤💥
Thoroughly impressed with the clarity and structure of your Redux Toolkit tutorial. A fantastic resource for anyone diving into React Native development.
Well-done tutorial, Mr. DevGeek! Your practical approach to Redux Toolkit in React Native is highly appreciated.
Invaluable guide by Mr. DevGeek on Redux Toolkit in React Native, offering clear insights for beginners.
Your breakdown of Redux Toolkit and Redux Persist is spot-on! Thank you for simplifying the complexities and making it accessible for learners.
Mr. DevGeek, your teaching style is amazing
Thank you, Your clear explanations make it easier for beginners like me to understand.
Mr. DevGeek, your tutorial is a goldmine for React Native developers!
Great content please create more contents.🔥🔥🔥🔥
Great work, Mr. DevGeek!
a very usefull video, thank you Mr DevGeek.
Great Knowledge. May Allah give you big reward. please upload continously such excelent content.
Ameen, I'm and I'll upload in Sha Allah
❤ great explanation Amair Bhai
where should I add the provider in expo project?
Brother make a video for how to integrate Firebase Analytics into React Native
Thank you Mr. DevGeek
Amazig Video thanks for like
Just Subsribed , love the fact that you say inshAllah , May Allah give barakah in this channel , simply awesome way to explain redux toolkit , in a way the even a beginner developer like me can understand. MashAllah
Jazak Allah ♥️, but I'm curious to know the mystery of your name!!
Thanks for uploading
Upload video by using RTK Query API data fetching in this project
Thanks brother 🙂
dispacth(increment()); getting type undefined error in clicking button.
dispatch typo error
Please watch the video carefully, or clone my GitHub repo and compare it with your code
plz make one full stack app crud with API's using RTQuery and also make tutorial on RTQuery plz
Hi your video is great, how can I connect to you
Thanks,
If you have any queries? You can get in touch with me on Instagram: @mrdevgeek
How to call api with token on redux
You have to setup this logic where you define your base URL with axios.
this interceptor run on every api call
import jwtDecode from 'jwt-decode';
export const API = axios.create({
baseURL: '',
});
API.interceptors.request.use(
async function (config) {
// getting access token
const {tokens} = store.getState().auth;
let {accessToken} = tokens;
// decoded token data
const decodedToken = jwtDecode(accessToken)
// extraction timestamp
const expiryTimestamp = new Date(decodedToken.exp * 1000);
// checking if token expire
if (expiryTimestamp < new Date()) {
console.log('token expire');
try {
// if token expire get new token
const response = await axios.post(`${API_KEY}/user/token`, {
refreshToken: tokens.refreshToken,
});
console.log('RESPONSE[GET_NEW_TOKEN]', response);
if (response?.status === 200) {
// getting token from server data
const newToken = response?.data?.tokens;
// saving new tokens locally
storage.set(ASYNC_TOKEN_KEY, JSON.stringify(newToken));
//await AsyncStorage.setItem(ASYNC_TOKEN_KEY, JSON.stringify(newToken));
accessToken = newToken?.accessToken;
}
// console.debug('Data returned', data);
} catch (error) {
Toast.show('Token expire unable to get new Token try again later', Toast.LONG);
console.log('ERROR[UNABLE_TO_GET_TOKEN]', error);
}
// injecting our token into header
config.headers.Authorization = `Bearer ${accessToken}`;
}
return config;
},
function (error) {
return Promise.reject(error);
},
);
thanks please give full video on api call with token@@mrdevgeek
thanks bro
Roses are red.
The skies are blue.
The title is in English why aren't you?
Change your title as Hindi. Which is quite annoying to see such click bait tutorials out there.
Thank you for your feedback! I understand your concern. While there are many channels that create content in various languages but use English titles, my goal is to reach a broader audience with my tutorials in Urdu. Using English titles helps more people find and benefit from the content. I appreciate your understanding and support!
Hello Sir I Really Need Your Help If user buy a subscription of our react native app so i want to provide them payment slip so how i can implement it please guide me
You can use revenueCat or react native IAP for this
Amazig Video thanks for like
Amazig Video thanks for like
Amazig Video thanks for like
Amazig Video thanks for like