rename username parameter to userId

This commit is contained in:
Zamitto 2024-06-16 19:51:09 -03:00
parent 05cb66f2a4
commit d048d562a3
6 changed files with 9 additions and 9 deletions

View file

@ -7,10 +7,10 @@ import { getSteamAppAsset } from "@main/helpers";
const getUser = async (
_event: Electron.IpcMainInvokeEvent,
username: string
userId: string
): Promise<UserProfile | null> => {
try {
const response = await HydraApi.get(`/user/${username}`);
const response = await HydraApi.get(`/user/${userId}`);
const profile = response.data;
const recentGames = await Promise.all(

View file

@ -130,7 +130,7 @@ contextBridge.exposeInMainWorld("electron", {
getMe: () => ipcRenderer.invoke("getMe"),
/* User */
getUser: (username: string) => ipcRenderer.invoke("getUser", username),
getUser: (userId: string) => ipcRenderer.invoke("getUser", userId),
/* Auth */
signout: () => ipcRenderer.invoke("signout"),

View file

@ -13,7 +13,7 @@ export function SidebarProfile() {
};
const handleClickLogin = () => {
window.electron.openExternal("https://losbroxas.org");
window.electron.openExternal("https://auth.losbroxas.org");
};
if (isLoading) return null;

View file

@ -117,7 +117,7 @@ declare global {
onSignOut: (cb: () => void) => () => Electron.IpcRenderer;
/* User */
getUser: (username: string) => Promise<UserProfile | null>;
getUser: (userId: string) => Promise<UserProfile | null>;
/* Profile */
getMe: () => Promise<UserProfile | null>;

View file

@ -55,7 +55,7 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
<Route path="/game/:shop/:objectID" Component={GameDetails} />
<Route path="/search" Component={SearchResults} />
<Route path="/settings" Component={Settings} />
<Route path="/user/:username" Component={User} />
<Route path="/user/:userId" Component={User} />
</Route>
</Routes>
</HashRouter>

View file

@ -10,19 +10,19 @@ import { vars } from "@renderer/theme.css";
import * as styles from "./user.css";
export const User = () => {
const { username } = useParams();
const { userId } = useParams();
const [userProfile, setUserProfile] = useState<UserProfile>();
const dispatch = useAppDispatch();
useEffect(() => {
window.electron.getUser(username!).then((userProfile) => {
window.electron.getUser(userId!).then((userProfile) => {
if (userProfile) {
dispatch(setHeaderTitle(userProfile.displayName));
setUserProfile(userProfile);
}
});
}, [dispatch, username]);
}, [dispatch, userId]);
return (
<SkeletonTheme baseColor={vars.color.background} highlightColor="#444">