Changes of attributes a uses of functions
Changes attribute featured_img_id to _thumbnail_id Changes attribute fatured_img to thumbnail Changes the use of function insert_thumbnai on repository and add a commentary for it Hides expand all in case of has none filter Fixes exhibition of page title on events
This commit is contained in:
parent
c484b091bd
commit
8b84ed6121
|
@ -23,12 +23,12 @@
|
|||
</a>
|
||||
<figure class="image is-128x128">
|
||||
<span
|
||||
v-if="collection.featured_image == undefined || collection.featured_image == false"
|
||||
v-if="collection.thumbnail == undefined || collection.thumbnail == false"
|
||||
class="image-placeholder">{{ $i18n.get('label_empty_thumbnail') }}</span>
|
||||
<img
|
||||
id="thumbail-image"
|
||||
:alt="$i18n.get('label_thumbnail')"
|
||||
:src="(collection.featured_image == undefined || collection.featured_image == false) ? thumbPlaceholderPath : collection.featured_image">
|
||||
:src="(collection.thumbnail == undefined || collection.thumbnail == false) ? thumbPlaceholderPath : collection.thumbnail">
|
||||
</figure>
|
||||
<div class="thumbnail-buttons-row">
|
||||
<a
|
||||
|
@ -319,7 +319,7 @@ export default {
|
|||
description: '',
|
||||
slug: '',
|
||||
enable_cover_page: '',
|
||||
featured_image: '',
|
||||
thumbnail: '',
|
||||
header_image: '',
|
||||
files:[],
|
||||
moderators_ids: []
|
||||
|
@ -521,7 +521,7 @@ export default {
|
|||
|
||||
this.updateThumbnail({collectionId: this.collectionId, thumbnailId: 0})
|
||||
.then(() => {
|
||||
this.collection.featured_image = false;
|
||||
this.collection.thumbnail = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$console.error(error);
|
||||
|
@ -548,7 +548,7 @@ export default {
|
|||
onSave: (mediaId) => {
|
||||
this.updateThumbnail({collectionId: this.collectionId, thumbnailId: mediaId})
|
||||
.then((res) => {
|
||||
this.collection.featured_image = res.featured_image;
|
||||
this.collection.thumbnail = res.thumbnail;
|
||||
})
|
||||
.catch(error => this.$console.error(error));
|
||||
}
|
||||
|
|
|
@ -198,8 +198,8 @@
|
|||
<!-- Thumbnail -------------------------------- -->
|
||||
<label class="section-label">{{ $i18n.get('label_thumbnail') }}</label>
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('items', 'featured_img_id')"
|
||||
:message="$i18n.getHelperMessage('items', 'featured_img_id')"/>
|
||||
:title="$i18n.getHelperTitle('items', '_thumbnail_id')"
|
||||
:message="$i18n.getHelperMessage('items', '_thumbnail_id')"/>
|
||||
<div class="document-box">
|
||||
<div class="thumbnail-field">
|
||||
<a
|
||||
|
@ -211,12 +211,12 @@
|
|||
</a>
|
||||
<figure class="image">
|
||||
<span
|
||||
v-if="item.featured_image == undefined || item.featured_image == false"
|
||||
v-if="item.thumbnail == undefined || item.thumbnail == false"
|
||||
class="image-placeholder">{{ $i18n.get('label_empty_thumbnail') }}</span>
|
||||
<img
|
||||
id="thumbail-image"
|
||||
:alt="$i18n.get('label_thumbnail')"
|
||||
:src="(item.featured_image == undefined || item.featured_image == false) ? thumbPlaceholderPath : item.featured_image">
|
||||
:src="(item.thumbnail == undefined || item.thumbnail == false) ? thumbPlaceholderPath : item.thumbnail">
|
||||
</figure>
|
||||
<div class="thumbnail-buttons-row">
|
||||
<a
|
||||
|
@ -447,7 +447,7 @@ export default {
|
|||
deleteThumbnail() {
|
||||
this.updateThumbnail({itemId: this.itemId, thumbnailId: 0})
|
||||
.then(() => {
|
||||
this.item.featured_image = false;
|
||||
this.item.thumbnail = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$console.error(error);
|
||||
|
@ -483,7 +483,7 @@ export default {
|
|||
onSave: (mediaId) => {
|
||||
this.updateThumbnail({itemId: this.itemId, thumbnailId: mediaId})
|
||||
.then((res) => {
|
||||
this.item.featured_image = res.featured_image;
|
||||
this.item.thumbnail = res.thumbnail;
|
||||
})
|
||||
.catch(error => this.$console.error(error));
|
||||
}
|
||||
|
|
|
@ -28,16 +28,16 @@
|
|||
tabindex="0"
|
||||
:label="$i18n.get('label_thumbnail')"
|
||||
:aria-label="$i18n.get('label_thumbnail')"
|
||||
field="featured_image"
|
||||
field="thumbnail"
|
||||
width="55">
|
||||
<template
|
||||
v-if="props.row.featured_image"
|
||||
v-if="props.row.thumbnail"
|
||||
slot-scope="scope">
|
||||
<router-link
|
||||
tag="img"
|
||||
:to="{path: $routerHelper.getCollectionPath(props.row.id)}"
|
||||
class="table-thumb clickable-row"
|
||||
:src="`${props.row.featured_image}`"/>
|
||||
:src="`${props.row.thumbnail}`"/>
|
||||
</template>
|
||||
</b-table-column>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<p/>
|
||||
<div class="has-text-weight-bold is-capitalized">{{ `${key.replace('_', ' ')}:` }}</div>
|
||||
<div v-if="key === 'featured_image'">
|
||||
<div v-if="key === 'thumbnail'">
|
||||
<div class="image is-128x128">
|
||||
<img :src="diff.old">
|
||||
</div>
|
||||
|
@ -81,7 +81,7 @@
|
|||
:class="{ 'has-text-success': !diff.old, 'back-hlight': !diff.old }">
|
||||
{{ `${key.replace('_', ' ')}:` }}
|
||||
</div>
|
||||
<div v-if="key === 'featured_image'">
|
||||
<div v-if="key === 'thumbnail'">
|
||||
<div class="image is-128x128">
|
||||
<img :src="diff.new">
|
||||
</div>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<p/>
|
||||
<div class="has-text-weight-bold is-capitalized">{{ `${key.replace('_', ' ')}:` }}</div>
|
||||
<div v-if="key === 'featured_image'">
|
||||
<div v-if="key === 'thumbnail'">
|
||||
<div class="image is-128x128">
|
||||
<img :src="diff.old">
|
||||
</div>
|
||||
|
@ -79,7 +79,7 @@
|
|||
:class="{ 'has-text-success': !diff.old, 'back-hlight': !diff.old }">
|
||||
{{ `${key.replace('_', ' ')}:` }}
|
||||
</div>
|
||||
<div v-if="key === 'featured_image'">
|
||||
<div v-if="key === 'thumbnail'">
|
||||
<div class="image is-128x128">
|
||||
<img :src="diff.new">
|
||||
</div>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<div class="has-text-weight-bold is-capitalized">
|
||||
{{ `${key.replace('_', ' ')}:` }}
|
||||
</div>
|
||||
<div v-if="key === 'featured_image'">
|
||||
<div v-if="key === 'thumbnail'">
|
||||
<div class="image is-128x128">
|
||||
<img :src="diff.new">
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
'primary-page': isRepositoryLevel,
|
||||
'page-container': isRepositoryLevel
|
||||
}">
|
||||
<tainacan-title v-if="!isRepositoryLevel" />
|
||||
<tainacan-title />
|
||||
<div
|
||||
class="columns"
|
||||
:class="{ 'above-subheader': isRepositoryLevel }">
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
<h3 class="has-text-weight-semibold">{{ $i18n.get('filters') }}</h3>
|
||||
<a
|
||||
v-if="!isLoadingFilters && filters.length > 0"
|
||||
class="collapse-all is-size-7"
|
||||
@click="toggleCollapseAll">
|
||||
{{ collapseAll ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
|
||||
|
@ -233,7 +234,7 @@
|
|||
name: this.$i18n.get('label_thumbnail'),
|
||||
field: 'row_thumbnail',
|
||||
field_type: undefined,
|
||||
slug: 'featured_image',
|
||||
slug: 'thumbnail',
|
||||
id: undefined,
|
||||
display: true
|
||||
});
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
<br>
|
||||
|
||||
<div
|
||||
v-if="item.featured_image"
|
||||
v-if="item.thumbnail"
|
||||
class="media">
|
||||
<figure
|
||||
class="media-left" >
|
||||
<p class="image is-128x128">
|
||||
<img :src="item.featured_image">
|
||||
<img :src="item.thumbnail">
|
||||
</p>
|
||||
</figure>
|
||||
<div class="media-content">
|
||||
|
|
|
@ -12,7 +12,7 @@ class Collection extends Entity {
|
|||
protected
|
||||
$diplay_name,
|
||||
$full,
|
||||
$featured_img_id,
|
||||
$_thumbnail_id,
|
||||
$modification_date,
|
||||
$creation_date,
|
||||
$author_id,
|
||||
|
@ -68,7 +68,7 @@ class Collection extends Entity {
|
|||
public function __toArray() {
|
||||
$array_collection = parent::__toArray();
|
||||
|
||||
$array_collection['featured_image'] = $this->get_featured_image();
|
||||
$array_collection['thumbnail'] = $this->get_thumbnail();
|
||||
$array_collection['header_image'] = $this->get_header_image();
|
||||
$array_collection['author_name'] = $this->get_author_name();
|
||||
|
||||
|
@ -204,7 +204,7 @@ class Collection extends Entity {
|
|||
/**
|
||||
* @return false|string
|
||||
*/
|
||||
function get_featured_image() {
|
||||
function get_thumbnail() {
|
||||
return get_the_post_thumbnail_url( $this->get_id(), 'full' );
|
||||
}
|
||||
|
||||
|
@ -218,18 +218,18 @@ class Collection extends Entity {
|
|||
/**
|
||||
* @param $id
|
||||
*/
|
||||
function set_featured_img_id( $id ) {
|
||||
$this->set_mapped_property( 'featured_img_id', $id );
|
||||
function set__thumbnail_id( $id ) {
|
||||
$this->set_mapped_property( '_thumbnail_id', $id );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|string
|
||||
*/
|
||||
|
||||
function get_featured_img_id() {
|
||||
$featured_img_id = $this->get_mapped_property("featured_img_id");
|
||||
if ( isset( $featured_img_id ) ) {
|
||||
return $featured_img_id;
|
||||
function get__thumbnail_id() {
|
||||
$_thumbnail_id = $this->get_mapped_property("_thumbnail_id");
|
||||
if ( isset( $_thumbnail_id ) ) {
|
||||
return $_thumbnail_id;
|
||||
}
|
||||
|
||||
return get_post_thumbnail_id( $this->get_id() );
|
||||
|
|
|
@ -13,7 +13,7 @@ class Item extends Entity {
|
|||
$terms,
|
||||
$diplay_name,
|
||||
$full,
|
||||
$featured_img_id,
|
||||
$_thumbnail_id,
|
||||
$modification_date,
|
||||
$creation_date,
|
||||
$author_id,
|
||||
|
@ -52,8 +52,8 @@ class Item extends Entity {
|
|||
public function __toArray() {
|
||||
$array_item = parent::__toArray();
|
||||
|
||||
$array_item['featured_image'] = $this->get_featured_image();
|
||||
$array_item['featured_img_id'] = $this->get_featured_img_id();
|
||||
$array_item['thumbnail'] = $this->get_thumbnail();
|
||||
$array_item['_thumbnail_id'] = $this->get__thumbnail_id();
|
||||
$array_item['author_name'] = $this->get_author_name();
|
||||
|
||||
return $array_item;
|
||||
|
@ -125,24 +125,24 @@ class Item extends Entity {
|
|||
/**
|
||||
* @return false|string
|
||||
*/
|
||||
function get_featured_image() {
|
||||
function get_thumbnail() {
|
||||
return get_the_post_thumbnail_url( $this->get_id(), 'full' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
*/
|
||||
function set_featured_img_id( $id ) {
|
||||
$this->set_mapped_property( 'featured_img_id', $id );
|
||||
function set__thumbnail_id( $id ) {
|
||||
$this->set_mapped_property( '_thumbnail_id', $id );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|string
|
||||
*/
|
||||
function get_featured_img_id() {
|
||||
$featured_img_id = $this->get_mapped_property("featured_img_id");
|
||||
if ( isset( $featured_img_id ) ) {
|
||||
return $featured_img_id;
|
||||
function get__thumbnail_id() {
|
||||
$_thumbnail_id = $this->get_mapped_property("_thumbnail_id");
|
||||
if ( isset( $_thumbnail_id ) ) {
|
||||
return $_thumbnail_id;
|
||||
}
|
||||
|
||||
return get_post_thumbnail_id( $this->get_id() );
|
||||
|
|
|
@ -40,7 +40,7 @@ export const filter_type_mixin = {
|
|||
.then(res => {
|
||||
if (res.data.length > 0) {
|
||||
for (let item of res.data) {
|
||||
this.options.push({label: item.title, value: item.id, img: item.featured_image });
|
||||
this.options.push({label: item.title, value: item.id, img: item.thumbnail });
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -186,7 +186,7 @@ class Collections extends Repository {
|
|||
'description' => __( 'The IDs of users assigned as moderators of this collection', 'tainacan' ),
|
||||
'validation' => ''
|
||||
],
|
||||
'featured_img_id' => [
|
||||
'_thumbnail_id' => [
|
||||
'map' => 'meta',
|
||||
'title' => __( 'Featured image ID', 'tainacan' ),
|
||||
'description' => __( 'Featured image ID', 'tainacan' )
|
||||
|
|
|
@ -106,7 +106,7 @@ class Items extends Repository {
|
|||
'on_error' => __( 'Invalid document', 'tainacan' ),
|
||||
'default' => ''
|
||||
],
|
||||
'featured_img_id' => [
|
||||
'_thumbnail_id' => [
|
||||
'map' => 'meta',
|
||||
'title' => __( 'Featured image ID', 'tainacan' ),
|
||||
'description' => __( 'Featured image ID', 'tainacan' )
|
||||
|
|
|
@ -312,20 +312,20 @@ class Logs extends Repository {
|
|||
|
||||
if ( $is_update ) {
|
||||
$msn = $this->prepare_event_message($class_name, 'updated');
|
||||
$description = $this->prepare_description_message($new_value, $name, $class_name, 'updated');
|
||||
$description = $this->prepare_event_description_message($new_value, $name, $class_name, 'updated');
|
||||
} elseif( $is_delete ){
|
||||
// was deleted
|
||||
$msn = $this->prepare_event_message($class_name, 'deleted');
|
||||
$description = $this->prepare_description_message($new_value, $name, $class_name, 'deleted');
|
||||
$description = $this->prepare_event_description_message($new_value, $name, $class_name, 'deleted');
|
||||
} elseif( !empty($diffs) ) {
|
||||
// was created
|
||||
$msn = $this->prepare_event_message($class_name, 'created');
|
||||
$description = $this->prepare_description_message($new_value, $name, $class_name, 'created');
|
||||
$description = $this->prepare_event_description_message($new_value, $name, $class_name, 'created');
|
||||
|
||||
} elseif( $is_trash ) {
|
||||
// was trashed
|
||||
$msn = $this->prepare_event_message($class_name, 'trashed');
|
||||
$description = $this->prepare_description_message($new_value, $name, $class_name, 'trashed');
|
||||
$description = $this->prepare_event_description_message($new_value, $name, $class_name, 'trashed');
|
||||
}
|
||||
|
||||
$msn = apply_filters( 'tainacan-insert-log-message-title', $msn, $type, $new_value );
|
||||
|
@ -363,7 +363,7 @@ class Logs extends Repository {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
private function prepare_description_message($object, $name, $class_name, $action_message){
|
||||
private function prepare_event_description_message($object, $name, $class_name, $action_message){
|
||||
if ( $object instanceof Entities\Field || $object instanceof Entities\Item || $object instanceof Entities\Filter) {
|
||||
$collection = $object->get_collection();
|
||||
$parent = $collection;
|
||||
|
|
|
@ -129,12 +129,10 @@ abstract class Repository {
|
|||
// Now run through properties stored as postmeta
|
||||
foreach ( $map as $prop => $mapped ) {
|
||||
if ( $mapped['map'] == 'meta' || $mapped['map'] == 'meta_multi' ) {
|
||||
$this->insert_metadata( $obj, $prop );
|
||||
$diffs = $this->insert_metadata( $obj, $prop, $diffs );
|
||||
}
|
||||
}
|
||||
|
||||
$diffs = $this->insert_thumbnail( $obj, $diffs );
|
||||
|
||||
// TODO: Logs for header image insert and update
|
||||
|
||||
do_action( 'tainacan-insert', $obj, $diffs, $is_update );
|
||||
|
@ -150,9 +148,11 @@ abstract class Repository {
|
|||
* @param \Tainacan\Entities $obj The entity object
|
||||
* @param string $prop the property name, as declared in the map of the repository
|
||||
*
|
||||
* @param $diffs
|
||||
*
|
||||
* @return null|false on error
|
||||
*/
|
||||
public function insert_metadata( $obj, $prop ) {
|
||||
public function insert_metadata( $obj, $prop, $diffs ) {
|
||||
$map = $this->get_map();
|
||||
|
||||
if ( ! array_key_exists( $prop, $map ) ) {
|
||||
|
@ -160,16 +160,26 @@ abstract class Repository {
|
|||
}
|
||||
|
||||
if ( $map[ $prop ]['map'] == 'meta' ) {
|
||||
update_post_meta( $obj->get_id(), $prop, $this->maybe_add_slashes( $obj->get_mapped_property( $prop ) ) );
|
||||
|
||||
if($prop === '_thumbnail_id'){
|
||||
$diffs = $this->insert_thumbnail($obj, $diffs);
|
||||
|
||||
return $diffs;
|
||||
} else {
|
||||
update_post_meta( $obj->get_id(), $prop, $this->maybe_add_slashes( $obj->get_mapped_property( $prop ) ) );
|
||||
}
|
||||
|
||||
} elseif ( $map[ $prop ]['map'] == 'meta_multi' ) {
|
||||
$values = $obj->get_mapped_property( $prop );
|
||||
$current_values = get_post_meta( $obj->get_id(), $prop );
|
||||
|
||||
if (empty($values) || !is_array($values))
|
||||
if (empty($values) || !is_array($values)) {
|
||||
$values = [];
|
||||
}
|
||||
|
||||
if (empty($current_values) || !is_array($current_values))
|
||||
if (empty($current_values) || !is_array($current_values)) {
|
||||
$current_values = [];
|
||||
}
|
||||
|
||||
$deleted = array_diff( $current_values, $values );
|
||||
$added = array_diff( $values, $current_values );
|
||||
|
@ -183,6 +193,8 @@ abstract class Repository {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
return $diffs;
|
||||
}
|
||||
|
||||
function maybe_add_slashes( $value ) {
|
||||
|
@ -710,61 +722,62 @@ abstract class Repository {
|
|||
}
|
||||
}
|
||||
|
||||
unset($diff['id'], $diff['collection_id'], $diff['author_id'], $diff['creation_date'], $diff['featured_img_id']);
|
||||
unset($diff['id'], $diff['collection_id'], $diff['author_id'], $diff['creation_date'], $diff['_thumbnail_id']);
|
||||
$diff = apply_filters( 'tainacan-entity-diff', $diff, $new, $old );
|
||||
|
||||
return $diff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts or update thumbnail for items and collections and return an array
|
||||
* with old thumbnail and new thumbnail
|
||||
*
|
||||
* @param $obj
|
||||
* @param $diffs
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function insert_thumbnail( $obj, $diffs ) {
|
||||
if ( method_exists( $obj, 'get_featured_img_id' ) ) {
|
||||
if ( ! get_post_thumbnail_id( $obj->WP_Post->ID ) ) {
|
||||
// was added a thumbnail
|
||||
private function insert_thumbnail( $obj, $diffs ) {
|
||||
if ( ! get_post_thumbnail_id( $obj->WP_Post->ID ) ) {
|
||||
// was added a thumbnail
|
||||
|
||||
$settled = set_post_thumbnail( $obj->WP_Post, (int) $obj->get_featured_img_id() );
|
||||
$settled = set_post_thumbnail( $obj->WP_Post, (int) $obj->get__thumbnail_id() );
|
||||
|
||||
if ( $settled ) {
|
||||
if ( $settled ) {
|
||||
|
||||
$thumbnail_url = get_the_post_thumbnail_url( $obj->WP_Post->ID );
|
||||
$thumbnail_url = get_the_post_thumbnail_url( $obj->WP_Post->ID );
|
||||
|
||||
$diffs['featured_image'] = [
|
||||
'new' => $thumbnail_url,
|
||||
'old' => '',
|
||||
'diff_with_index' => 0,
|
||||
];
|
||||
$diffs['thumbnail'] = [
|
||||
'new' => $thumbnail_url,
|
||||
'old' => '',
|
||||
'diff_with_index' => 0,
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// was updated a thumbnail
|
||||
|
||||
$old_thumbnail = get_the_post_thumbnail_url( $obj->WP_Post->ID );
|
||||
|
||||
$fid = $obj->get__thumbnail_id();
|
||||
|
||||
if ( ! $fid ) {
|
||||
$settled = delete_post_thumbnail( $obj->WP_Post );
|
||||
} else {
|
||||
$settled = set_post_thumbnail( $obj->WP_Post, (int) $fid );
|
||||
}
|
||||
|
||||
// was update a thumbnail
|
||||
if ( $settled ) {
|
||||
|
||||
$old_thumbnail = get_the_post_thumbnail_url( $obj->WP_Post->ID );
|
||||
$thumbnail_url = get_the_post_thumbnail_url( $obj->WP_Post->ID );
|
||||
|
||||
$fid = $obj->get_featured_img_id();
|
||||
|
||||
if ( ! $fid ) {
|
||||
$settled = delete_post_thumbnail( $obj->WP_Post );
|
||||
} else {
|
||||
$settled = set_post_thumbnail( $obj->WP_Post, (int) $fid );
|
||||
}
|
||||
|
||||
if ( $settled ) {
|
||||
|
||||
$thumbnail_url = get_the_post_thumbnail_url( $obj->WP_Post->ID );
|
||||
|
||||
$diffs['featured_image'] = [
|
||||
'new' => $thumbnail_url,
|
||||
'old' => $old_thumbnail,
|
||||
'diff_with_index' => 0,
|
||||
];
|
||||
}
|
||||
$diffs['thumbnail'] = [
|
||||
'new' => $thumbnail_url,
|
||||
'old' => $old_thumbnail,
|
||||
'diff_with_index' => 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ export const fetchAttachments = ({ commit }, collection_id) => {
|
|||
export const updateThumbnail = ({ commit }, { collectionId, thumbnailId }) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.patch('/collections/' + collectionId, {
|
||||
featured_img_id: thumbnailId
|
||||
_thumbnail_id: thumbnailId
|
||||
}).then( res => {
|
||||
let collection = res.data
|
||||
commit('setCollection', collection);
|
||||
|
|
|
@ -164,7 +164,7 @@ export const fetchAttachments = ({ commit }, item_id) => {
|
|||
export const updateThumbnail = ({ commit }, { itemId, thumbnailId }) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.patch('/items/' + itemId, {
|
||||
featured_img_id: thumbnailId
|
||||
_thumbnail_id: thumbnailId
|
||||
}).then( res => {
|
||||
let item = res.data
|
||||
commit('setItem', item);
|
||||
|
|
Loading…
Reference in New Issue