قمت بعملية post ناجحة وظهرت لى هذه ال res .. اريد ان اقوم بتخزين التوكن القادم من ال response
const [Data, setData] = useState([]);
const loginStudent = () => {
axios
.post('https://carna-test-app234/api/v2/login', {
type: 3,
method_type: 'email',
email: 'student@app321.com',
password: '123456',
})
.then(res => {
console.log(res.data);
setData(res.data);
})
.catch(err => console.log(err));
};
وهذه ال response تظهر لى ..
كيف أخزن هذه ال response فى متغيريات ؟؟ انا اريد تخزين التوكن فما الحل ؟
{
"user": {
"id": 625,
"name": "ahmed",
"email": "teacher@app312.com",
"phone": "87654321",
"type": 2,
"lang": "ar",
"fcm_status": 1,
"social": 0,
"verified_at": null,
"working_times": [],
},
"token_type": "Bearer",
"expires_at": "2022-05-21 20:15:27",
"status": 200,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjUxMDZhNzNhZjRmZDg0NTliMjc4MTc2ZDZlNjE3NDU2MDg2NzViOWVlZjYyMDIyYTlhM2M1NWE5MzU1MzY1ZDEzZGFiODU3NDEyZGY4YzhhIn0.eyJhdWQiOiIzIiwianRpIjoiNTEwNmE3M2FmNGZkODQ1OWIyNzgxNzZkNmU2MTc0NTYwODY3NWI5ZWVmNjIwMjJhOWEzYzU1YTkzNTUzNjVkMTNkYWI4NTc0MTJkZjhjOGEiLCJpYXQiOjE2MjE2MjA5MjcsIm5iZiI6MTYyMTYyMDkyNywiZXhwIjoxNjUzMTU2OTI3LCJzdWIiOiI2MjUiLCJzY29wZXMiOltdfQ.tvDMG3sNjL7g9FhXM7CfFQ7obXT_SU6NOSvqx09WOOWnd8ciPkRa1QtTcNVhU5uDpmEIqihzB88ojLbFi1PSqpFiIDv1yYsasTOrmnshpWJ7vZlRWOYcUPXWcy3sKEw2BNxqPpD270nrTgsf6vn_BtcQlGKL-eejuPoyXXj9cbU5uZZRfxE151QtiVr4Hfsde-33UqT5fmJVvJr-IkJxfUmmUrT2h98FHjJn7rHxqGwIYmH9TcMF99P-WwPw-8t6d_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