|
@@ -47,15 +47,7 @@
|
|
:user-id="song.requestedBy"
|
|
:user-id="song.requestedBy"
|
|
:link="true"
|
|
:link="true"
|
|
/>
|
|
/>
|
|
- {{
|
|
|
|
- formatDistance(
|
|
|
|
- parseISO(song.requestedAt),
|
|
|
|
- new Date(),
|
|
|
|
- {
|
|
|
|
- includeSeconds: true
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
- }}
|
|
|
|
|
|
+ {{ formatedRequestedAt }}
|
|
ago
|
|
ago
|
|
</strong>
|
|
</strong>
|
|
</p>
|
|
</p>
|
|
@@ -197,7 +189,9 @@ export default {
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- utils
|
|
|
|
|
|
+ utils,
|
|
|
|
+ formatedRequestedAt: null,
|
|
|
|
+ formatRequestedAtInterval: null
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -206,7 +200,29 @@ export default {
|
|
userRole: state => state.user.auth.role
|
|
userRole: state => state.user.auth.role
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ mounted() {
|
|
|
|
+ if (this.requestedBy) {
|
|
|
|
+ this.formatRequestedAt();
|
|
|
|
+ this.formatRequestedAtInterval = setInterval(() => {
|
|
|
|
+ this.formatRequestedAt();
|
|
|
|
+ }, 30000);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ unmounted() {
|
|
|
|
+ clearInterval(this.formatRequestedAtInterval);
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
|
|
+ formatRequestedAt() {
|
|
|
|
+ if (
|
|
|
|
+ this.requestedBy &&
|
|
|
|
+ this.song.requestedBy &&
|
|
|
|
+ this.song.requestedAt
|
|
|
|
+ )
|
|
|
|
+ this.formatedRequestedAt = this.formatDistance(
|
|
|
|
+ parseISO(this.song.requestedAt),
|
|
|
|
+ new Date()
|
|
|
|
+ );
|
|
|
|
+ },
|
|
formatArtists() {
|
|
formatArtists() {
|
|
if (this.song.artists.length === 1) {
|
|
if (this.song.artists.length === 1) {
|
|
return this.song.artists[0];
|
|
return this.song.artists[0];
|