Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced useDispatch w. useQuery/request: Users (src/Components/Users/**) [5 out of 5 components] #6596

Merged
merged 31 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d6304d5
replaced getUserDetails and getUserListSkills actions with useQuery
thedevildude Nov 12, 2023
75d1cf8
replaced partialUpdateUser action with request
thedevildude Nov 13, 2023
3477a15
replaced updatePassword action with request
thedevildude Nov 13, 2023
7a7ad19
replaced dispatch with useQuery in UserFilter.tsx
thedevildude Nov 14, 2023
d796faa
Bug Fix: UserFilter tried fetching district when district_id was not …
thedevildude Nov 14, 2023
46711b3
addUser and checkUsername action replaced with request
thedevildude Nov 19, 2023
01a21c5
replaced useDispatch with request in UserAdd component
thedevildude Nov 19, 2023
98fcdbf
replaced useDispatch with useQuery and request in SkillsSlideOver
thedevildude Nov 20, 2023
cfed5c9
replaced useDispatch with useQuery and request in ManageUsers
thedevildude Nov 21, 2023
693b0d6
solved issue #6652 | passed user skills as props to SkillSelect
thedevildude Nov 21, 2023
ae1f31b
removed unnecessary console logs
thedevildude Nov 21, 2023
50522a1
re-added showAll as dependency to skillSearch
thedevildude Nov 21, 2023
56e32e7
removed unnecessary console logs
thedevildude Nov 21, 2023
fc3dd26
replaced fetchDistrict request with useQuery and removed isLoading
thedevildude Nov 22, 2023
7151dc2
fixed error notification in ManageUsers
thedevildude Nov 22, 2023
0af88d4
removed unnecessary useState from ManageUsers
thedevildude Nov 22, 2023
884e134
code fixes in SkillsSlideOver
thedevildude Nov 22, 2023
3e92f4f
code fixes in UserAdd
thedevildude Nov 22, 2023
94fae55
code fix in UserFilter
thedevildude Nov 23, 2023
15227b0
code fix in UserProfile
thedevildude Nov 24, 2023
1117e11
removed redundant code
thedevildude Nov 24, 2023
241d711
Merge branch 'develop' into issue#6530
thedevildude Nov 24, 2023
9a0bfad
added proper types and fixed redundant code
thedevildude Nov 24, 2023
723ff55
removed redundant fireRequest actions
thedevildude Nov 24, 2023
3bfc84e
fix http 301 redirect due to missing trailing slash
rithviknishad Nov 25, 2023
164ca19
Merge branch 'develop' into issue#6530
rithviknishad Nov 25, 2023
b739413
Merge branch 'develop' into issue#6530
nihal467 Nov 28, 2023
f792cfc
Merge branch 'develop' into issue#6530
thedevildude Nov 29, 2023
40bf4cb
Merge branch 'develop' into issue#6530
thedevildude Nov 30, 2023
de5144b
Update TRes of userListFacility in src/Redux/api.tsx
thedevildude Nov 30, 2023
7cc2c75
resolved imports
thedevildude Nov 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions src/Components/Common/SkillSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback } from "react";
import { useDispatch } from "react-redux";
import { getAllSkills, getUserListSkills } from "../../Redux/actions";
import { getAllSkills } from "../../Redux/actions";
import AutoCompleteAsync from "../Form/AutoCompleteAsync";
import { SkillObjectModel } from "../Users/models";
import { SkillModel, SkillObjectModel } from "../Users/models";

interface SkillSelectProps {
id?: string;
Expand All @@ -17,6 +17,7 @@ interface SkillSelectProps {
selected: SkillObjectModel | SkillObjectModel[] | null;
setSelected: (selected: SkillObjectModel) => void;
username?: string;
userSkills?: SkillModel[];
}

export const SkillSelect = (props: SkillSelectProps) => {
Expand All @@ -32,7 +33,8 @@ export const SkillSelect = (props: SkillSelectProps) => {
disabled = false,
className = "",
errors = "",
username,
//username,
userSkills,
} = props;

const dispatchAction: any = useDispatch();
Expand All @@ -47,21 +49,16 @@ export const SkillSelect = (props: SkillSelectProps) => {
};

const res = await dispatchAction(getAllSkills(params));

const linkedSkills = await dispatchAction(
getUserListSkills({ username: username })
);

const skillsList = linkedSkills?.data?.results;
const skillsID: string[] = [];
skillsList.map((skill: any) => skillsID.push(skill.skill_object.id));
userSkills?.map((skill: SkillModel) =>
skillsID.push(skill.skill_object.id)
);
const skills = res?.data?.results.filter(
(skill: any) => !skillsID.includes(skill.id)
);

return skills;
},
[dispatchAction, searchAll, showAll]
[dispatchAction, searchAll, userSkills, showAll]
);

return (
Expand Down
1 change: 1 addition & 0 deletions src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { RouteToFacility } from "../Common/RouteToFacilitySelect";
import { ConsultationDiagnosis, CreateDiagnosis } from "../Diagnosis/types";

export interface LocalBodyModel {
id: number;
name: string;
body_type: number;
localbody_code: string;
Expand Down
Loading
Loading