Skip to content

Commit

Permalink
M2-6042: Remove unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
sultanofcardio committed Apr 24, 2024
1 parent 36f52a4 commit c255e20
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/features/TakeNow/lib/useTakeNowValidation.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { useCallback, useRef, useState } from 'react';
import { useState } from 'react';

import { MultiInformantState } from '~/abstract/lib/types/multiInformant';
import { useActivityByIdQuery } from '~/entities/activity';
import { appletModel, useAppletByIdQuery } from '~/entities/applet';
import { useAppletByIdQuery } from '~/entities/applet';
import { useSubjectQuery } from '~/entities/subject';
import { useUserState } from '~/entities/user/model/hooks';
import { useWorkspaceAppletRespondent, useWorkspaceRolesQuery } from '~/entities/workspace';
import { TakeNowParams } from '~/features/TakeNow/lib/TakeNowParams.types';
import { WorkspaceRole } from '~/shared/api/types/workspace';
import { useNotification } from '~/shared/ui';
import { useCustomTranslation } from '~/shared/utils';

const TAKE_NOW_ROLES: WorkspaceRole[] = ['super_admin', 'owner', 'manager'];
Expand Down Expand Up @@ -60,11 +59,8 @@ export const useTakeNowValidation = ({
isLoading: isLoadingRespondent,
} = useWorkspaceAppletRespondent(workspaceId, appletId, respondentId);

const { showErrorNotification: showError } = useNotification();
const { t } = useCustomTranslation();
const { user } = useUserState();
const { initiateTakeNow, getMultiInformantState } = appletModel.hooks.useMultiInformantState();
const errorNotificationRef = useRef<number>(0);

const loadingState: TakeNowValidatedState = {
isLoading: true,
Expand All @@ -79,19 +75,6 @@ export const useTakeNowValidation = ({
error,
});

const showErrorNotification = useCallback(
(message: string) => {
if (errorNotificationRef.current < 2) {
showError(message, {
allowDuplicate: false,
duration: 7000,
});
errorNotificationRef.current += 1;
}
},
[showError, errorNotificationRef],
);

if (respondentId !== user.id) {
return errorState(t<string>('takeNow.invalidRespondent'));
}
Expand Down

0 comments on commit c255e20

Please sign in to comment.