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 (
|
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(
|
||||||
|
|
|
@ -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"),
|
||||||
|
|
|
@ -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;
|
||||||
|
|
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;
|
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>;
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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">
|
||||||
|
|
Loading…
Reference in a new issue