Skip to content

Commit

Permalink
Merge pull request #21 from haruhikonyan/main
Browse files Browse the repository at this point in the history
バグ修正再リリース
  • Loading branch information
haruhikonyan committed Nov 17, 2021
2 parents a9f83fa + 6af1ad2 commit 68a9596
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/javascript/components/pages/mypage/index.tsx
Expand Up @@ -25,7 +25,7 @@ type FilterQuery = { startDate: string, endDate: string, scene: string, searchWo
const MyMeals: React.VFC<{ meals: MealWithDishes[], filterQuery: FilterQuery, sceneLabelAndValues: sceneLabelAndValues, deleteMealHundler: (meal: MealWithDishes) => void }> = ({ meals, filterQuery, sceneLabelAndValues, deleteMealHundler }) => {
const [displayMeals, setDesplayMeals] = useState(meals);
const { register, handleSubmit, watch } = useForm<FilterQuery>({
defaultValues: { scene: 'all', ...filterQuery },
defaultValues: { ...filterQuery, scene: filterQuery.scene != null ? filterQuery.scene : 'all' },
});

const searchWord = watch('searchWord');
Expand All @@ -43,8 +43,7 @@ const MyMeals: React.VFC<{ meals: MealWithDishes[], filterQuery: FilterQuery, sc
}, [searchWord, scene])

const onSubmitDate = (data: FilterQuery) => {
console.log(data);
location.href = `/mypage?start_date=${data.startDate}&end_date=${data.endDate}&search_word=${data.searchWord}&scene=${data.scene}`;
location.href = `/mypage?start_date=${data.startDate}&end_date=${data.endDate}&search_word=${data.searchWord ?? ''}&scene=${data.scene}`;
}

return (
Expand Down

0 comments on commit 68a9596

Please sign in to comment.