@@ -8,7 +59,8 @@
@@ -69,62 +121,3 @@
-
-
diff --git a/front/src/store/player.ts b/front/src/store/player.ts
index ecd3c8a71..bb4349cee 100644
--- a/front/src/store/player.ts
+++ b/front/src/store/player.ts
@@ -148,8 +148,9 @@ const store: Module = {
if (!rootState.auth.authenticated) {
return
}
- return axios.post('history/listenings/', { track: track.id }).then(() => {}, () => {
- logger.error('Could not record track in history')
+
+ return axios.post('history/listenings/', { track: track.id }).catch((error) => {
+ logger.error('Could not record track in history', error)
})
},
trackEnded ({ commit, dispatch, rootState }) {
diff --git a/front/src/types.ts b/front/src/types.ts
index 72a233e4e..2975beef2 100644
--- a/front/src/types.ts
+++ b/front/src/types.ts
@@ -186,6 +186,14 @@ export interface Radio {
user: User
}
+export interface Listening {
+ id: string
+ track: Track
+ user: User
+ actor: Actor
+ creation_date: string
+}
+
// API stuff
export interface APIErrorResponse extends Record {}
@@ -226,6 +234,11 @@ export interface ListenWSEvent {
object: ListenWsEventObject
}
+// TODO (wvffle): Add reactivity to recently listened / favorited / added (#1316, #1534)
+// export interface ListenWSEvent extends Listening {
+// type: 'Listen'
+// }
+
export type WebSocketEvent = PendingReviewEditsWSEvent | PendingReviewReportsWSEvent | PendingReviewRequestsWSEvent | ListenWSEvent
// FS Browser