Skip to content

Commit

Permalink
fix(GoalPage): check project before transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
awinogradov committed Aug 9, 2023
1 parent 12f9828 commit 5e4c55b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/GoalPage/GoalPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ export const GoalPage = ({ user, ssrTime, params: { id } }: ExternalPageProps<{

const changeProjectMutation = trpc.goal.changeProject.useMutation();
const onGoalTransfer = useCallback(
async ({ id: projectId }: { id: string }) => {
if (goal) {
async (project?: { id: string }) => {
if (project && goal) {
const promise = changeProjectMutation.mutateAsync({
id: goal?.id,
projectId,
projectId: project.id,
});

await notifyPromise(promise, 'goalsUpdate');
Expand Down

0 comments on commit 5e4c55b

Please sign in to comment.