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 ( const getUser = async (
_event: Electron.IpcMainInvokeEvent, _event: Electron.IpcMainInvokeEvent,
username: string userId: string
): Promise<UserProfile | null> => { ): Promise<UserProfile | null> => {
try { try {
const response = await HydraApi.get(`/user/${username}`); const response = await HydraApi.get(`/user/${userId}`);
const profile = response.data; const profile = response.data;
const recentGames = await Promise.all( const recentGames = await Promise.all(

View file

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

View file

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

View file

@ -117,7 +117,7 @@ declare global {
onSignOut: (cb: () => void) => () => Electron.IpcRenderer; onSignOut: (cb: () => void) => () => Electron.IpcRenderer;
/* User */ /* User */
getUser: (username: string) => Promise<UserProfile | null>; getUser: (userId: string) => Promise<UserProfile | null>;
/* Profile */ /* Profile */
getMe: () => Promise<UserProfile | null>; 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="/game/:shop/:objectID" Component={GameDetails} />
<Route path="/search" Component={SearchResults} /> <Route path="/search" Component={SearchResults} />
<Route path="/settings" Component={Settings} /> <Route path="/settings" Component={Settings} />
<Route path="/user/:username" Component={User} /> <Route path="/user/:userId" Component={User} />
</Route> </Route>
</Routes> </Routes>
</HashRouter> </HashRouter>

View file

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