Skip to content

Commit

Permalink
fix: movie.year was missing since RTK Query implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
simonc56 committed Oct 11, 2024
1 parent d801c09 commit 4f9f07a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/features/moviesApiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import {
} from '../@types/MovieState';
import MovieType, { Genre, MovieResultType, MovieUserData } from '../@types/MovieType';
import apiSlice from '../apiHandler/apiSlice';
import { isoDateToYear } from '../utils/utils';

export const moviesApiSlice = apiSlice.enhanceEndpoints({ addTagTypes: ['MovieUserdata'] }).injectEndpoints({
endpoints: (builder: EndpointBuilder<BaseQueryFn, string, string>) => ({
getMovieById: builder.query<MovieType, string | number>({
query: (id) => ({
url: `/movie/${id}`,
}),
transformResponse: (response: MovieType) => ({ ...response, year: isoDateToYear(response.release_date) }),
}),
getUserdataMovieById: builder.query<MovieUserData, string | number>({
query: (id) => ({
Expand Down

0 comments on commit 4f9f07a

Please sign in to comment.