fix: invalid username checks

This commit is contained in:
Steven
2023-09-18 22:34:31 +08:00
parent 2375001453
commit bff41a8957
22 changed files with 106 additions and 132 deletions

View File

@ -5,7 +5,7 @@ import { useUserV1Store } from "@/store/v1";
const useCurrentUser = () => {
const userStore = useUserStore();
const userV1Store = useUserV1Store();
const currentUsername = userStore.getCurrentUsername();
const currentUsername = userStore.state.user?.username;
useEffect(() => {
if (currentUsername) {
@ -13,7 +13,7 @@ const useCurrentUser = () => {
}
}, [currentUsername]);
return userV1Store.getUserByUsername(currentUsername);
return userV1Store.getUserByUsername(currentUsername || "");
};
export default useCurrentUser;