Browse Source

fix issues with fetching my collection

pull/130/head
Phillip 2 years ago
parent
commit
1d2bdfeeb4
  1. 22
      qortal-ui-plugins/plugins/core/components/ChatGifs/ChatGifs.js

22
qortal-ui-plugins/plugins/core/components/ChatGifs/ChatGifs.js

@ -176,7 +176,7 @@ setOpenGifModal: { attribute: false }
let collectionObj = collection; let collectionObj = collection;
try { try {
const metaData = await parentEpml.request('apiCall', { const metaData = await parentEpml.request('apiCall', {
url: `/arbitrary/metadata/GIF_REPOSITORY/${this.myAccountName}/${collection.identifier}?apiKey=${this.getApiKey()}`, url: `/arbitrary/metadata/GIF_REPOSITORY/${collection.name}/${collection.identifier}?apiKey=${this.getApiKey()}`,
}); });
collectionObj = { collectionObj = {
@ -186,10 +186,10 @@ setOpenGifModal: { attribute: false }
if (metaData.files) { if (metaData.files) {
const metaDataArray = metaData.files.map((data) => { const metaDataArray = metaData.files.map((data) => {
return { return {
url: `${nodeUrl}/arbitrary/GIF_REPOSITORY/${this.myAccountName}/${collection.identifier}?filepath=${data}&apiKey=${this.getApiKey()}`, url: `${nodeUrl}/arbitrary/GIF_REPOSITORY/${collection.name}/${collection.identifier}?filepath=${data}&apiKey=${this.getApiKey()}`,
filePath: data, filePath: data,
identifier: collection.identifier, identifier: collection.identifier,
name: this.myAccountName name: collection.name
}; };
}); });
@ -289,7 +289,7 @@ setOpenGifModal: { attribute: false }
this.myAccountName = userName; this.myAccountName = userName;
if (this.myAccountName) { if (this.myAccountName) {
const getMyGifCollections = await parentEpml.request('apiCall', { const getMyGifCollections = await parentEpml.request('apiCall', {
url: `/arbitrary/resources?service=GIF_REPOSITORY&limit=0&name=${this.myAccountName}&apiKey=${this.getApiKey()}`, url: `/arbitrary/resources/search?service=GIF_REPOSITORY&query=${this.myAccountName}&apiKey=${this.getApiKey()}`,
}); });
const gifCollectionWithMetaData = await this.structureCollections( const gifCollectionWithMetaData = await this.structureCollections(
getMyGifCollections getMyGifCollections
@ -327,10 +327,14 @@ setOpenGifModal: { attribute: false }
const identifier = splitCollection[1]; const identifier = splitCollection[1];
try { try {
const data = await parentEpml.request('apiCall', { const data = await parentEpml.request('apiCall', {
url: `/arbitrary/resources?service=GIF_REPOSITORY&limit=0&name=${name}&identifier=${identifier}&apiKey=${this.getApiKey()}`, url: `/arbitrary/metadata/GIF_REPOSITORY/${name}/${identifier}?apiKey=${this.getApiKey()}`,
}); });
if (data.length > 0) { if (data.title) {
savedCollections.push(data[0]); savedCollections.push({
identifier,
name,
service: 'GIF_REPOSITORY'
});
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@ -403,7 +407,7 @@ setOpenGifModal: { attribute: false }
this.isLoading = true; this.isLoading = true;
const userName = await this.getName(this.selectedAddress.address); const userName = await this.getName(this.selectedAddress.address);
const doesNameExist = await parentEpml.request('apiCall', { const doesNameExist = await parentEpml.request('apiCall', {
url: `/arbitrary/resources?service=GIF_REPOSITORY&limit=0&name=${userName}&identifier=${this.newCollectionName}&apiKey=${this.getApiKey()}`, url: `/arbitrary/metadata/GIF_REPOSITORY/${userName}/${this.newCollectionName}?apiKey=${this.getApiKey()}`,
}); });
if (!userName) { if (!userName) {
@ -492,7 +496,7 @@ setOpenGifModal: { attribute: false }
let myCollection = await parentEpml.request( let myCollection = await parentEpml.request(
'apiCall', 'apiCall',
{ {
url: `/arbitrary/resources?service=GIF_REPOSITORY&limit=0&name=${userName}&identifier=${this.newCollectionName}&apiKey=${this.getApiKey()}`, url: `/arbitrary/metadata/GIF_REPOSITORY/${userName}/${this.newCollectionName}&apiKey=${this.getApiKey()}`,
} }
); );
if (myCollection.length > 0) { if (myCollection.length > 0) {

Loading…
Cancel
Save