TelegramPWA/src/global/actions/ui/stickerSearch.ts
2025-06-04 20:36:48 +02:00

30 lines
812 B
TypeScript

import type { ActionReturnType } from '../../types';
import { getCurrentTabId } from '../../../util/establishMultitabRole';
import { addActionHandler } from '../../index';
import { updateTabState } from '../../reducers/tabs';
addActionHandler('setStickerSearchQuery', (global, actions, payload): ActionReturnType => {
const { query, tabId = getCurrentTabId() } = payload;
return updateTabState(global, {
stickerSearch: {
query,
resultIds: undefined,
},
}, tabId);
});
addActionHandler('setGifSearchQuery', (global, actions, payload): ActionReturnType => {
const { query, tabId = getCurrentTabId() } = payload;
return updateTabState(global, {
gifSearch: {
query,
offset: undefined,
// offsetId: undefined,
results: undefined,
},
}, tabId);
});