257 { productId: number; lastId?: number }
258 >({
259 query: ({ productId, lastId }) =>
260 `products/messages/${productId}/${lastId || 0}`,261 }),
262 updateUser: builder.mutation<void, any>({
263 query: (data: any) => ({
249 { postId: number; lastId?: number }
250 >({
251 query: ({ postId, lastId }) =>
252 `products/comments/${postId}/${lastId || 0}`,253 providesTags: ['Comments'],
254 }),
255 getChatMessages: builder.query<
165 { lastId?: number; productId: number; channel: string }
166 >({
167 query: ({ lastId, productId, channel }) =>
168 `products/posts/${productId}/${channel}/${lastId || 0}`,169 providesTags: ['Posts'],
170 }),
171 getProductInfo: builder.query<
109 query: ({ name, follow, accessToken }) => ({
110 url: `products/${follow ? 'follow' : 'unfollow'}/${name}`,
111 method: 'POST',
112 body: { accessToken: accessToken || '' },113 }),
114 invalidatesTags: ['User'],
115 }),
66 { field: string; lastId?: number }
67 >({
68 query: ({ field, lastId }) =>
69 `products/latest_posts/${field}/${lastId || 0}`, 70 providesTags: ['Posts', 'User'],
71 }),
72 getUserInfo: builder.query<UserInfo, void>({
Expressions that consistently result in either true or false when comparing values, and logical operations like ||, &&, and ?? that consistently either skip or fully evaluate their operands, often indicate mistakes. Logical operations that always yield the same result could lead to unexpected behavior or bugs in the program.
const arrIsEmpty = someArr === [] // Will always evaluate to false
const arrIsEmpty = someArr.length === 0