Replaces all 'patch' usages by 'put' on requests

This commit is contained in:
mateuswetah 2024-06-25 16:14:11 -03:00
parent 2008239372
commit 479976e399
9 changed files with 23 additions and 23 deletions

View File

@ -234,7 +234,7 @@
let val = this.valueComponent;
if ((!Array.isArray(val) || val.length == 0) && this.itemMetadatum.metadatum.multiple === 'no') {
tainacanApi.patch(`/item/${this.itemMetadatum.item.id}/metadata/${this.itemMetadatum.metadatum.id}`, {
tainacanApi.put(`/item/${this.itemMetadatum.item.id}/metadata/${this.itemMetadatum.metadatum.id}`, {
values: term.id,
}).then(() => {
this.isAddingNewTermVaue = false;
@ -244,7 +244,7 @@
} else {
val = val ? val : [];
val.push( this.getComponent == ('tainacan-taxonomy-checkbox' || 'tainacan-taxonomy-radio') ? term.id : {'label': term.name, 'value': term.id} );
tainacanApi.patch(`/item/${this.itemMetadatum.item.id}/metadata/${this.itemMetadatum.metadatum.id}`, {
tainacanApi.put(`/item/${this.itemMetadatum.item.id}/metadata/${this.itemMetadatum.metadatum.id}`, {
values: val,
}).then(() => {
this.isAddingNewTermVaue = false;

View File

@ -46,7 +46,7 @@ export const fetchProcesses = ({ commit }, {page, processesPerPage, shouldUpdate
export const updateProcess = ({ commit }, { id, status }) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch(`/bg-processes/${id}/`, {
axios.tainacanApi.put(`/bg-processes/${id}/`, {
status: status,
})
.then( res => {

View File

@ -3,7 +3,7 @@ import axios from '../../../axios'
// ROLES
export const addCapabilityToRole = ({ commit }, { capabilityKey, role }) => {
return new Promise(( resolve, reject ) => {
axios.tainacanApi.patch('/roles/' + role + '?add_cap=' + capabilityKey)
axios.tainacanApi.put('/roles/' + role + '?add_cap=' + capabilityKey)
.then( res => {
let role = res.data;
commit('addCapabilityToRole', {capabilityKey, role });
@ -17,7 +17,7 @@ export const addCapabilityToRole = ({ commit }, { capabilityKey, role }) => {
export const removeCapabilityFromRole = ({ commit }, { capabilityKey, role }) => {
return new Promise(( resolve, reject ) => {
axios.tainacanApi.patch('/roles/' + role + '?remove_cap=' + capabilityKey)
axios.tainacanApi.put('/roles/' + role + '?remove_cap=' + capabilityKey)
.then( res => {
let role = res.data;
commit('removeCapabilityFromRole', {capabilityKey, role });
@ -79,7 +79,7 @@ export const updateRole = ({ commit }, role) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch('/roles/' + role.slug, role)
axios.tainacanApi.put('/roles/' + role.slug, role)
.then(res => {
const updatedRole = res.data
commit('setRole', updatedRole);

View File

@ -348,7 +348,7 @@ export const updateCollection = ({ commit }, {
collection
}) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch('/collections/' + collection_id + '?context=edit', collection).then( res => {
axios.tainacanApi.put('/collections/' + collection_id + '?context=edit', collection).then( res => {
commit('setCollection', collection);
resolve( res.data );
}).catch( error => {
@ -416,7 +416,7 @@ export const fetchAttachments = ({ commit }, collection_id) => {
export const updateThumbnail = ({ commit }, { collectionId, thumbnailId }) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch('/collections/' + collectionId + '?context=edit', {
axios.tainacanApi.put('/collections/' + collectionId + '?context=edit', {
_thumbnail_id: thumbnailId
}).then( res => {
let collection = res.data
@ -431,7 +431,7 @@ export const updateThumbnail = ({ commit }, { collectionId, thumbnailId }) => {
export const updateHeaderImage = ({ commit }, { collectionId, headerImageId }) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch('/collections/' + collectionId + '?context=edit', {
axios.tainacanApi.put('/collections/' + collectionId + '?context=edit', {
header_image_id: headerImageId + ''
}).then( res => {
let collection = res.data

View File

@ -27,7 +27,7 @@ export const createExporterSession = ({commit}, slug) => {
export const updateExporterSession = ({commit}, exporterSessionUpdated) => {
return new Promise(( resolve, reject ) => {
tainacanApi.patch(`/exporters/session/${exporterSessionUpdated.id}`, exporterSessionUpdated.body)
tainacanApi.put(`/exporters/session/${exporterSessionUpdated.id}`, exporterSessionUpdated.body)
.then(response => {
commit('setExporterSession');
resolve( response.data );

View File

@ -128,7 +128,7 @@ export const addTemporaryFilter = ({ commit }, filter ) => {
export const updateCollectionFiltersOrder = ({ commit }, { collectionId, filtersOrder }) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch('/collections/' + collectionId + '/filters_order?context=edit', {
axios.tainacanApi.put('/collections/' + collectionId + '/filters_order?context=edit', {
filters_order: filtersOrder
}).then( res => {
commit('collection/setCollection', res.data, { root: true });

View File

@ -8,7 +8,7 @@ export const updateItemMetadatum = ({ commit }, { item_id, metadatum_id, values,
body['parent_meta_id'] = parent_meta_id;
return new Promise((resolve, reject) => {
axios.tainacanApi.patch(`/item/${item_id}/metadata/${metadatum_id}`, body)
axios.tainacanApi.put(`/item/${item_id}/metadata/${metadatum_id}`, body)
.then( res => {
let itemMetadatum = res.data;
commit('setSingleMetadatum', itemMetadatum);
@ -45,7 +45,7 @@ export const fetchItemMetadata = ({ commit }, item_id) => {
export const fetchCompoundFirstParentMetaId = ({ commit }, { item_id, metadatum_id }) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch(`/item/${item_id}/metadata/${metadatum_id}`, { value: [] })
axios.tainacanApi.put(`/item/${item_id}/metadata/${metadatum_id}`, { value: [] })
.then( res => {
const parentMetaId = res.data.parent_meta_id;
resolve(parentMetaId);
@ -157,7 +157,7 @@ export const sendItem = ( { commit }, item) => {
export const updateItem = ({ commit }, item) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch('/items/' + item.id, item)
axios.tainacanApi.put('/items/' + item.id, item)
.then( res => {
commit('setItem', res.data);
commit('setLastUpdated');
@ -191,7 +191,7 @@ export const updateItemDocument = ({ commit }, { item_id, document, document_typ
params['document_options'] = document_options;
return new Promise((resolve, reject) => {
axios.tainacanApi.patch('/items/' + item_id, params).then( res => {
axios.tainacanApi.put('/items/' + item_id, params).then( res => {
let item = res.data;
commit('setItem', item);
@ -246,7 +246,7 @@ export const sendAttachment = ( { commit }, { item_id, file }) => {
export const removeAttachmentFromItem = ( { commit }, attachmentId) => {
commit('cleanAttachment');
return new Promise(( resolve, reject ) => {
axios.wpApi.patch('/media/' + attachmentId, {
axios.wpApi.put('/media/' + attachmentId, {
post: 0
})
.then( res => {
@ -306,7 +306,7 @@ export const fetchAttachments = ({ commit }, { page, attachmentsPerPage, itemId,
export const updateThumbnail = ({ commit }, { itemId, thumbnailId, thumbnailAlt }) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch('/items/' + itemId, {
axios.tainacanApi.put('/items/' + itemId, {
_thumbnail_id: thumbnailId
}).then( res => {
let item = res.data
@ -322,7 +322,7 @@ export const updateThumbnail = ({ commit }, { itemId, thumbnailId, thumbnailAlt
export const updateThumbnailAlt = ({ commit }, { thumbnailId, thumbnailAlt }) => {
return new Promise((resolve, reject) => {
axios.wpApi.patch('/media/' + thumbnailId + '?force=true', {
axios.wpApi.put('/media/' + thumbnailId + '?force=true', {
alt_text: thumbnailAlt
}).then( res => {
let thumbnail = res.data;

View File

@ -202,7 +202,7 @@ export const cleanMetadata = ({commit}) => {
export const updateCollectionMetadataOrder = ({ commit }, { collectionId, metadataOrder, metadataSectionId }) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch('/collections/' + collectionId + '/metadata_section/' + metadataSectionId + '/metadata_order?context=edit', {
axios.tainacanApi.put('/collections/' + collectionId + '/metadata_section/' + metadataSectionId + '/metadata_order?context=edit', {
metadata_order: metadataOrder
}).then(res => {
commit('collection/setCollection', res.data, { root: true });
@ -390,7 +390,7 @@ export const updateMetadataSections = ({commit}, metadataSections) => {
export const updateCollectionMetadataSectionsOrder = ({ commit }, {collectionId, metadataSectionsOrder }) => {
return new Promise((resolve, reject) => {
axios.tainacanApi.patch('/collections/' + collectionId + '/metadata_section_order?context=edit', {
axios.tainacanApi.put('/collections/' + collectionId + '/metadata_section_order?context=edit', {
metadata_section_order: metadataSectionsOrder
}).then(res => {
commit('collection/setCollection', res.data, { root: true });

View File

@ -33,7 +33,7 @@ export const deleteTaxonomy = ({ commit }, { taxonomyId, isPermanently }) => {
export const updateTaxonomy = ({ commit }, taxonomy) => {
return new Promise(( resolve, reject ) => {
axios.tainacanApi.patch(`/taxonomies/${taxonomy.taxonomyId}`, taxonomy)
axios.tainacanApi.put(`/taxonomies/${taxonomy.taxonomyId}`, taxonomy)
.then( res => {
let taxonomy = res.data;
commit('setTaxonomy', taxonomy);
@ -191,7 +191,7 @@ export const updateTerm = ({}, { taxonomyId, term, itemId, metadatumId }) => {
term['metadatum_id'] = metadatumId;
return new Promise(( resolve, reject ) => {
axios.tainacanApi.patch(`/taxonomy/${taxonomyId}/terms/${term.id}`, term)
axios.tainacanApi.put(`/taxonomy/${taxonomyId}/terms/${term.id}`, term)
.then( res => {
const updatedTerm = res.data;
resolve( updatedTerm );
@ -254,7 +254,7 @@ export const changeTermsParent = ({}, { taxonomyId, newParentTerm, terms, parent
query += `&include=${terms}`;
return new Promise(( resolve, reject ) => {
axios.tainacanApi.patch(`/taxonomy/${taxonomyId}/terms/newparent/${newParentTerm}?${query}`)
axios.tainacanApi.put(`/taxonomy/${taxonomyId}/terms/newparent/${newParentTerm}?${query}`)
.then(res => {
const terms = res.data;
resolve( terms );