IO-1132 improve caching after insert.
This commit is contained in:
@@ -23,9 +23,7 @@ export default function JobDocumentsComponent({ job, loading, refetch }) {
|
||||
job.documents.map((doc) => {
|
||||
return {
|
||||
source: {
|
||||
uri: `${env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType(
|
||||
doc.type
|
||||
)}/upload/${doc.key}`,
|
||||
uri: GenerateSrcUrl(doc),
|
||||
},
|
||||
};
|
||||
}),
|
||||
@@ -62,11 +60,7 @@ export default function JobDocumentsComponent({ job, loading, refetch }) {
|
||||
source={{
|
||||
width: 100,
|
||||
height: 100,
|
||||
uri: `${
|
||||
env.REACT_APP_CLOUDINARY_ENDPOINT
|
||||
}/${DetermineFileType(object.item.type)}/upload/${
|
||||
env.REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS
|
||||
}/${object.item.key}`,
|
||||
uri: GenerateThumbUrl(object.item),
|
||||
}}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
@@ -84,3 +78,17 @@ export default function JobDocumentsComponent({ job, loading, refetch }) {
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export const GenerateSrcUrl = (value) => {
|
||||
let extension = value.extension;
|
||||
if (extension && extension.includes("heic")) extension = "jpg";
|
||||
|
||||
return `${env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType(
|
||||
value.type
|
||||
)}/upload/${value.key}${extension ? `.${extension}` : ""}`;
|
||||
};
|
||||
|
||||
export const GenerateThumbUrl = (value) =>
|
||||
`${env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType(
|
||||
value.type
|
||||
)}/upload/${env.REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS}/${value.key}`;
|
||||
|
||||
Reference in New Issue
Block a user