mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 12:30:06 +02:00
add optimistic update for favorite/ratings mutations
This commit is contained in:
@@ -3,12 +3,10 @@ import { AxiosError } from 'axios';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { MutationOptions } from '/@/renderer/lib/react-query';
|
||||
import { usePlayEvent } from '/@/renderer/store/event.store';
|
||||
import { ScrobbleArgs, ScrobbleResponse } from '/@/shared/types/domain-types';
|
||||
|
||||
export const useSendScrobble = (options?: MutationOptions) => {
|
||||
// const incrementPlayCount = useIncrementQueuePlayCount();
|
||||
const sendPlayEvent = usePlayEvent();
|
||||
|
||||
return useMutation<ScrobbleResponse, AxiosError, ScrobbleArgs, null>({
|
||||
mutationFn: (args) => {
|
||||
@@ -21,7 +19,7 @@ export const useSendScrobble = (options?: MutationOptions) => {
|
||||
// Manually increment the play count for the song in the queue if scrobble was submitted
|
||||
if (variables.query.submission) {
|
||||
// incrementPlayCount([variables.query.id]);
|
||||
sendPlayEvent(variables.query.id);
|
||||
// sendPlayEvent(variables.query.id);
|
||||
}
|
||||
},
|
||||
...options,
|
||||
|
||||
Reference in New Issue
Block a user