mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-15 04:32:13 +00:00
rename username parameter to userId
This commit is contained in:
parent
05cb66f2a4
commit
d048d562a3
6 changed files with 9 additions and 9 deletions
|
@ -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(
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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;
|
||||
|
|
2
src/renderer/src/declaration.d.ts
vendored
2
src/renderer/src/declaration.d.ts
vendored
|
@ -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>;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue