Answer the question
In order to leave comments, you need to log in
How to get data (array) without disturbing the order of Yii2/Axios elements?
At my backend, an array is given in the order in which I need it.
$list = Category::getSortedList();
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
return (isset($list) && !empty($list)) ? $list : [];
try {
const response = await axios.get(url);
if(response.data !== null && response.data !== undefined){
return Object.values(response.data);
}else {
return [];
}
}catch(error){
console.log(error);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question