Skip to content

Commit ffa7ab8

Browse files
get store name from constant
1 parent 047baaf commit ffa7ab8

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/features/ai-modal/features/modal/components/form/Form.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useDispatch } from '@wordpress/data';
77
* Internal dependencies
88
*/
99
import { MODAL_STATUS } from '@constants/modal';
10+
import { DATA_STORE } from '@constants/stores';
1011
import CloseButton from '../CloseButton';
1112

1213
import styles from '../../index.module.css';
@@ -28,7 +29,7 @@ const Form = ({
2829
onSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
2930
hasApiKey: boolean;
3031
}): JSX.Element => {
31-
const { setStatus, setSelection } = useDispatch('theme/ai');
32+
const { setStatus, setSelection } = useDispatch(DATA_STORE);
3233

3334
const handleClose = () => {
3435
setStatus(MODAL_STATUS.INITIAL);

src/features/ai-modal/features/modal/components/modal-text/ModalControlsText.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
} from '../../../../utils';
2424

2525
import { MODAL_STATUS } from '@constants/modal';
26+
import { DATA_STORE } from '@constants/stores';
2627

2728
import type { ModalStatus, ModalSelection, ModalSettings } from 'types/modal';
2829

@@ -35,13 +36,13 @@ import styles from '../../index.module.css';
3536
const ModalControlsText = (): JSX.Element | null => {
3637
const { status, selection, settings } = useSelect((select: WPAny) => {
3738
return {
38-
status: select('theme/ai').getStatus() as ModalStatus,
39-
selection: select('theme/ai').getSelection() as ModalSelection,
40-
settings: select('theme/ai').getSettings() as ModalSettings,
39+
status: select(DATA_STORE).getStatus() as ModalStatus,
40+
selection: select(DATA_STORE).getSelection() as ModalSelection,
41+
settings: select(DATA_STORE).getSettings() as ModalSettings,
4142
};
4243
}, []);
4344

44-
const { setStatus, setSelection } = useDispatch('theme/ai');
45+
const { setStatus, setSelection } = useDispatch(DATA_STORE);
4546
const { getText } = useChatGPT();
4647

4748
const handleCLose = () => {

src/features/ai-modal/features/modal/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useSelect } from '@wordpress/data';
88
* Internal dependencies
99
*/
1010
import { MODAL_STATUS } from '@constants/modal';
11+
import { DATA_STORE } from '@constants/stores';
1112

1213
import ModalControlsText from './components/modal-text/ModalControlsText';
1314
import ModalControlsImage from './components/modal-image/ModalControlsImage';
@@ -30,7 +31,7 @@ const Modal = ({
3031
}): JSX.Element | null => {
3132
const { status } = useSelect((select: WPAny) => {
3233
return {
33-
status: select('theme/ai').getStatus() as ModalStatus,
34+
status: select(DATA_STORE).getStatus() as ModalStatus,
3435
};
3536
}, []);
3637

0 commit comments

Comments
 (0)