git stash push -m "work in progress"
This commit is contained in:
1 parent
c30d6019df
commit
468a67f937
9 files changed
+230
-7
No files matched your search
@@ -7,7 +7,6 @@ export const useGetUser = (userId) => {
|
||||
const [user, setUser] = useState(undefined);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState(null);
|
||||
|
||||
const fetchUser = useCallback(async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
@@ -54,8 +53,29 @@ export const useEditUser = (userId) => {
|
||||
setIsLoading(false);
|
||||
}
|
||||
},
|
||||
[userId]
|
||||
[userId, t]
|
||||
);
|
||||
|
||||
return [editUser, isLoading, error];
|
||||
const changePassword = useCallback(
|
||||
async (passwordForm) => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
await networkService.changePasswordByAdmin({ userId, passwordForm });
|
||||
createToast({
|
||||
body: t("teamPanel.changeTeamPassword.success"),
|
||||
});
|
||||
} catch (error) {
|
||||
createToast({
|
||||
body: error.message,
|
||||
});
|
||||
setError(error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
},
|
||||
[userId, t]
|
||||
);
|
||||
|
||||
return [editUser, isLoading, error, changePassword];
|
||||
};
|
||||
Reference in new issue
Block a user