Showing proper name of project in global project dropdown when assigning project for first time
This commit is contained in:
parent
77f5632506
commit
21e7ca2157
@ -115,9 +115,6 @@ const Header = () => {
|
||||
if (projectExist) {
|
||||
cacheData("hasReceived", false);
|
||||
}
|
||||
if(!selectedProject){
|
||||
dispatch(setProjectId(projectNames[0]?.id));
|
||||
}
|
||||
}
|
||||
},
|
||||
[fetchData,projectNames,selectedProject]
|
||||
|
@ -175,6 +175,7 @@ export const useProjectName = () => {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [projectNames, setProjectName] = useState([]);
|
||||
const [Error, setError] = useState();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
@ -182,6 +183,9 @@ export const useProjectName = () => {
|
||||
setProjectName(response.data);
|
||||
cacheData("basicProjectNameList", response.data);
|
||||
setLoading(false);
|
||||
if(response.data.length === 1){
|
||||
dispatch(setProjectId(response.data[0]?.id));
|
||||
}
|
||||
} catch (err) {
|
||||
setError("Failed to fetch data.");
|
||||
setLoading(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user