Fix adding to collection to change value of is_public first try
This commit is contained in:
@@ -88,16 +88,18 @@
|
||||
return;
|
||||
} else {
|
||||
let adventure = event.detail;
|
||||
let formData = new FormData();
|
||||
formData.append('collection_id', collection.id.toString());
|
||||
|
||||
let res = await fetch(`/adventures/${adventure.id}?/addToCollection`, {
|
||||
method: 'POST',
|
||||
body: formData // Remove the Content-Type header
|
||||
let res = await fetch(`/api/adventures/${adventure.id}/`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ collection: collection.id.toString() })
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
console.log('Adventure added to collection');
|
||||
adventure = await res.json();
|
||||
adventures = [...adventures, adventure];
|
||||
} else {
|
||||
console.log('Error adding adventure to collection');
|
||||
|
||||
Reference in New Issue
Block a user