Skip to content

Commit

Permalink
fix(Greeting): getUpperUrl missing url param
Browse files Browse the repository at this point in the history
  • Loading branch information
ben196888 committed Jan 9, 2022
1 parent f0e87dc commit 8b122c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import Greeting from './Greeting';

import { Greeting } from './Greeting/Greeting';
import Board from './Board';
import { Lottery } from './Lottery/Lottery';
import configService from './services/configService';
Expand Down
13 changes: 6 additions & 7 deletions src/Greeting/index.js → src/Greeting/Greeting.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React, { useState } from 'react';
import React, { useCallback, useState } from 'react';
import './greeting.scss';

import { GreetingForm } from './GreetingForm';
import Dialog from '../Board/Dialog';
import { getUpperUrl } from '../utils/urlHelpers';
import { RouteComponentProps } from 'react-router-dom';

const Greeting = (props) => {
export const Greeting: React.FC<RouteComponentProps> = (props) => {
const [modalDisplay, setModalDisplay] = useState(false);

const [user, setUser] = useState({ name: '', greetings: '', imgUrl: '' });
const onSubmit = (formData) => {
const onSubmit = useCallback((formData: WeddiApp.Post.UserInput) => {
setUser(formData);
setModalDisplay(true);
setTimeout(() => { props.history.push(getUpperUrl()); }, 5000);
};
setTimeout(() => { props.history.push(getUpperUrl(props.match.url)); }, 5000);
}, [setUser, setModalDisplay, props.history, props.match.url]);

return (
<div className="greeting">
Expand All @@ -26,5 +27,3 @@ const Greeting = (props) => {
</div>
);
};

export default Greeting;

0 comments on commit 8b122c5

Please sign in to comment.