i hate flow
This commit is contained in:
parent
49395a8a05
commit
7a327596cd
1 changed files with 3 additions and 2 deletions
|
@ -91,9 +91,9 @@ type Props = {
|
||||||
|
|
||||||
function PublishForm(props: Props) {
|
function PublishForm(props: Props) {
|
||||||
// Detect upload type from query in URL
|
// Detect upload type from query in URL
|
||||||
|
const { push, location } = useHistory();
|
||||||
const urlParams = new URLSearchParams(location.search);
|
const urlParams = new URLSearchParams(location.search);
|
||||||
const uploadType = urlParams.get('type');
|
const uploadType = urlParams.get('type');
|
||||||
const history = useHistory();
|
|
||||||
|
|
||||||
// Component state
|
// Component state
|
||||||
const [mode, setMode] = React.useState(uploadType || PUBLISH_MODES.FILE);
|
const [mode, setMode] = React.useState(uploadType || PUBLISH_MODES.FILE);
|
||||||
|
@ -285,7 +285,7 @@ function PublishForm(props: Props) {
|
||||||
if (!uploadType) return;
|
if (!uploadType) return;
|
||||||
const newParams = new URLSearchParams();
|
const newParams = new URLSearchParams();
|
||||||
newParams.set('type', mode.toLowerCase());
|
newParams.set('type', mode.toLowerCase());
|
||||||
history.push({ search: newParams.toString() });
|
push({ search: newParams.toString() });
|
||||||
}, [mode, uploadType]);
|
}, [mode, uploadType]);
|
||||||
|
|
||||||
// @if TARGET='web'
|
// @if TARGET='web'
|
||||||
|
@ -401,6 +401,7 @@ function PublishForm(props: Props) {
|
||||||
label={__(MODE_TO_I18N_STR[String(modeName)] || '---')}
|
label={__(MODE_TO_I18N_STR[String(modeName)] || '---')}
|
||||||
button="alt"
|
button="alt"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
// $FlowFixMe
|
||||||
setMode(modeName);
|
setMode(modeName);
|
||||||
}}
|
}}
|
||||||
className={classnames('button-toggle', { 'button-toggle--active': mode === modeName })}
|
className={classnames('button-toggle', { 'button-toggle--active': mode === modeName })}
|
||||||
|
|
Loading…
Reference in a new issue