Все еще привыкаешь к React api-запросам. Не уверен, почему токен не определен после нажатия кнопки отправки. Вот мои вопросы. js в моей папке api.
import apiUrl from '../apiConfig'
import axios from 'axios'
export const createQuestion = (question, user) => {
return axios({
method: 'POST',
url: apiUrl + '/create-question',
headers: {
'Authorization': `Token token =${user.token}`
},
data: {
question: {
question: question.question,
description: question.description,
category: question.category
}
}
})
}