lint: remove unused code, code style and early update cached username

This commit is contained in:
Martin Raifer
2024-07-29 16:29:39 +02:00
parent 4646b67bac
commit b4eaeb3088
2 changed files with 7 additions and 13 deletions

View File

@@ -12,7 +12,6 @@ import planePhotoFrame from './plane_photo';
const apiUrl = 'https://api.panoramax.xyz/';
const tileUrl = apiUrl + 'api/map/{z}/{x}/{y}.mvt';
const imageBlobUrl = apiUrl + 'api/pictures/{pictureID}/{definition}.jpg';
const imageDataUrl = apiUrl + 'api/collections/{collectionId}/items/{itemId}';
const userIdUrl = apiUrl + 'api/users/search?q={username}';
const usernameURL = apiUrl + 'api/users/{userId}';
@@ -199,14 +198,6 @@ function loadTileDataToCache(data, tile) {
}
}
// Quick access to image
function getImageURL(image_id, definition){
const requestUrl = imageBlobUrl.replace('{pictureID}', image_id)
.replace('{definition}', definition);
return requestUrl;
}
async function getImageData(collection_id, image_id){
const requestUrl = imageDataUrl.replace('{collectionId}', collection_id)
.replace('{itemId}', image_id);
@@ -281,6 +272,7 @@ export default {
const responses = await Promise.all(requestUrls.map(requestUrl =>
fetch(requestUrl, { method: 'GET' })));
if (responses.some(response => !response.ok)) {
const response = responses.find(response => !response.ok);
throw new Error(response.status + ' ' + response.statusText);
}
const data = await Promise.all(responses.map(response => response.json()));

View File

@@ -65,13 +65,14 @@ export function svgPanoramaxImages(projection, context, dispatch) {
}
if (username && service) {
if (_activeUsernameFilter !== username) {
_activeUsernameFilter = username;
const tempIds = await service.getUserIds(username);
_activeUsernameFilter = username;
_activeIds = {};
tempIds.forEach(id => {
_activeIds[id] = true;
})
});
}
images = images.filter(function(image) {
@@ -109,13 +110,14 @@ export function svgPanoramaxImages(projection, context, dispatch) {
}
if (username && service) {
if (_activeUsernameFilter !== username) {
_activeUsernameFilter = username;
const tempIds = await service.getUserIds(username);
_activeUsernameFilter = username;
_activeIds = {};
tempIds.forEach(id => {
_activeIds[id] = true;
})
});
}
sequences = sequences.filter(function(sequence) {