Skip to content

Commit

Permalink
Fixes issues with non multitenant platforms (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio authored Aug 14, 2023
1 parent f75ced5 commit 310caf6
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 63 deletions.
2 changes: 1 addition & 1 deletion resources/js/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import queries from './queries';

export class AuthApi {
static async sendPlatfromRequest(data: Record<string, unknown>) {
return ApiService.sendPlatfromRequest(data, '/multi-tenant');
return ApiService.sendPlatformRequest(data, '/multi-tenant');
}

static async login(email: string, password: string) {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/api/beam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import queries from './queries';

export class BeamApi {
static async sendPlatfromRequest(data: Record<string, unknown>) {
return ApiService.sendPlatfromRequest(data, '/beam');
return ApiService.sendPlatformRequest(data, '/beam');
}

static async getBeam(getBeamData: Record<string, unknown>) {
Expand Down
22 changes: 11 additions & 11 deletions resources/js/api/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async getCollectionsIds(first: number = 20) {
Expand All @@ -23,7 +23,7 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async getCollection(collectionId: string) {
Expand All @@ -34,7 +34,7 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async createCollection(collectionData: Record<string, unknown>) {
Expand All @@ -50,7 +50,7 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async approveCollection(collectionData: Record<string, unknown>) {
Expand All @@ -65,7 +65,7 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async unapproveCollection(collectionData: Record<string, unknown>) {
Expand All @@ -79,7 +79,7 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async destroyCollection(collectionData: Record<string, unknown>) {
Expand All @@ -92,7 +92,7 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async mutateCollection(collectionData: Record<string, unknown>) {
Expand All @@ -106,7 +106,7 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async setCollectionAttribute(setCollectionAttributeData: Record<string, unknown>) {
Expand All @@ -121,7 +121,7 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async removeCollectionAttribute(removeCollectionAttributeData: Record<string, unknown>) {
Expand All @@ -135,7 +135,7 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async removeAllAttributes(removeAllAttributesData: Record<string, unknown>) {
Expand All @@ -150,6 +150,6 @@ export class CollectionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}
}
2 changes: 1 addition & 1 deletion resources/js/api/fueltank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import queries from './queries';

export class FuelTankApi {
static async sendPlatfromRequest(data: Record<string, unknown>) {
return ApiService.sendPlatfromRequest(data, '/fuel-tanks');
return ApiService.sendPlatformRequest(data, '/fuel-tanks');
}

static async getFuelTank(name: string, tankId: string) {
Expand Down
24 changes: 14 additions & 10 deletions resources/js/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ export class ApiService {
if (resp.status === 401) {
useAppStore().clearLogin();
snackbar.error({ title: 'Unauthorized', text: 'Session expired, try to sign in again' });
throw [{ field: 'Error', message: 'Unauthorized' }];
return { field: 'Error', message: 'Unauthorized' };
}

if (resp.status >= 400 && resp.status < 600) {
throw resp as unknown as Error;
return resp as unknown as Error;
}

return resp.json();
}

static async sendPlatfromRequest(data: Record<string, unknown>, schema: string = ''): Promise<any> {
static async sendPlatformRequest(data: Record<string, unknown>, schema: string = ''): Promise<any> {
const appStore = useAppStore();

return new Promise((resolve, reject) => {
Expand All @@ -78,9 +78,13 @@ export class ApiService {
} else {
reject({ field: 'Error', message });
}
} else {
resolve(res);
}

if (res.field == 'Error') {
reject(res);
}

resolve(res);
});
});
}
Expand Down Expand Up @@ -108,7 +112,7 @@ export class ApiService {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async thaw(thawData: Record<string, unknown>) {
Expand All @@ -125,7 +129,7 @@ export class ApiService {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async batchMint(batchMintData: Record<string, unknown>) {
Expand All @@ -142,7 +146,7 @@ export class ApiService {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async batchTransfer(batchTransferData: Record<string, unknown>) {
Expand All @@ -159,7 +163,7 @@ export class ApiService {
}),
},
};
return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async batchSetAttribute(batchSetAttributeData: Record<string, unknown>) {
Expand All @@ -174,6 +178,6 @@ export class ApiService {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}
}
2 changes: 1 addition & 1 deletion resources/js/api/marketplace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import queries from './queries';

export class MarketplaceApi {
static async sendPlatfromRequest(data: Record<string, unknown>) {
return ApiService.sendPlatfromRequest(data, '/marketplace');
return ApiService.sendPlatformRequest(data, '/marketplace');
}

static async getListings(getListingsData: Record<string, unknown>) {
Expand Down
22 changes: 11 additions & 11 deletions resources/js/api/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async approveToken(tokenData: Record<string, unknown>) {
Expand All @@ -33,7 +33,7 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async unapproveToken(tokenData: Record<string, unknown>) {
Expand All @@ -48,7 +48,7 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async burnToken(tokenData: Record<string, unknown>) {
Expand All @@ -67,7 +67,7 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async mutateToken(tokenData: Record<string, unknown>) {
Expand All @@ -88,7 +88,7 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async transferToken(tokenData: Record<string, unknown>) {
Expand All @@ -112,7 +112,7 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async createToken(tokenData: Record<string, unknown>) {
Expand All @@ -127,7 +127,7 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async mintToken(tokenData: Record<string, unknown>) {
Expand All @@ -142,7 +142,7 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async setTokenAttribute(setTokenAttributeData: Record<string, unknown>) {
Expand All @@ -158,7 +158,7 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async removeTokenAttribute(removeTokenAttributeData: Record<string, unknown>) {
Expand All @@ -173,7 +173,7 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async removeAllAttributes(removeAllAttributesData: Record<string, unknown>) {
Expand All @@ -188,6 +188,6 @@ export class TokenApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}
}
10 changes: 5 additions & 5 deletions resources/js/api/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class TransactionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async getTransactions(getTransactionsData: Record<string, unknown>) {
Expand All @@ -31,7 +31,7 @@ export class TransactionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async getWallet(walletData: Record<string, unknown>) {
Expand All @@ -45,7 +45,7 @@ export class TransactionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async retryTransactions(retryTransactionsData: Record<string, unknown>) {
Expand All @@ -57,7 +57,7 @@ export class TransactionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}

static async updateTransaction(updateTransactionData: Record<string, unknown>) {
Expand All @@ -73,6 +73,6 @@ export class TransactionApi {
},
};

return ApiService.sendPlatfromRequest(data);
return ApiService.sendPlatformRequest(data);
}
}
3 changes: 2 additions & 1 deletion resources/js/components/marketplace/BidsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
</span>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
{{ bid.price > 100 ? formatPriceFromENJ(bid.price) : bid.price }} {{ currencySymbol }}
{{ bid.price > 100 ? formatPriceFromENJ(bid.price) : bid.price }}
{{ currencySymbol }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
{{ addressShortHex(bid.bidder) }}
Expand Down
Loading

0 comments on commit 310caf6

Please sign in to comment.