Answer the question
In order to leave comments, you need to log in
Problem with WebDav Yandex Disk API??
What am I doing wrong with my request. In postman I get a picture, but in the request through my project I get errors
fetch('https://webdav.yandex.ru:443/winter.jpg',{method:'get',
headers:{
'Authorization':'OAuth AQAAAAAaK-00000111Ck0V9f11gmphkERRg5Pw',
'Host':'webdav.yandex.ru',
}})
Answer the question
In order to leave comments, you need to log in
Write to Yandex support to have them fix CORS. The problem here is that they first check the authorization, and then they figure out what method was called. And the browser, before making a request with authorization, pulls the OPTIONS method without authorization, to which the service must return headers allowing cross-domain requests and authorization. And when all the necessary headers are received, it already pulls GET with authorization. And postman wanted to spit on CORS, so everything works for him.
Good afternoon.
And how does the script determine which record to edit?
Therefore false also returns.
Do not invent and do not engage in nonsense.
First get the model that you will edit, and only then save the changes.
What you are doing now is to create a new entry. Use save() to save the data, although you also need to call save() to update.
ps
This is how a new entry will be made in the database
public function actionAddAuthor() {
$author = new ArticleAuthor();
if($author->load(Yii::$app->request->post() && $author->save()){
return $this->redirect(['article/edit-step3', 'id' => $author->article_id]);
}
}
public function actionEditAuthor($id) {
$author = $this->findModel($id); // тут select запрос, который возвращает модель для редактирования.
if($author->load(Yii::$app->request->post() && $author->save()){
return $this->redirect(['article/edit-step3', 'id' => $author->article_id]);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question