fix(riot-mui): creation date from tag list was not updating on page change

This commit is contained in:
Joxit 2022-12-27 00:05:29 +01:00
parent d13f81c9af
commit 696aa39012
No known key found for this signature in database
GPG key ID: F526592B8E012263

View file

@ -20,13 +20,21 @@
import { dateFormat } from '../../scripts/utils'; import { dateFormat } from '../../scripts/utils';
export default { export default {
onMounted(props) { onMounted(props) {
props.image.one('creation-date', (date) => { this.loadCreationDate(props);
this.update({ },
date: date, onUpdated(props) {
localDate: date && date.toLocaleString(), this.loadCreationDate(props);
},
loadCreationDate(props) {
if (!props.image.creationDate && !props.image.ociImage) {
props.image.one('creation-date', (date) => {
this.update({
date: date,
localDate: date && date.toLocaleString(),
});
}); });
}); props.image.trigger('get-date');
props.image.trigger('get-date'); }
}, },
getDate(image) { getDate(image) {
return !image.ociImage ? `${dateFormat(image.creationDate)} ago` : 'Not Available'; return !image.ociImage ? `${dateFormat(image.creationDate)} ago` : 'Not Available';