File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55# React Router
66/.react-router /
77/build /
8+ /.vite /
Original file line number Diff line number Diff line change 33import * as React from "react"
44import { useNavigate } from "react-router"
55import { type Account , getAccount , signout } from "~/backend/AccountBackend"
6- import { initServerUrl } from "~/lib/api"
76
87type AccountState = {
98 /** undefined = still loading; null = not signed in; Account = signed in */
@@ -19,7 +18,6 @@ export function AccountProvider({ children }: { children: React.ReactNode }) {
1918 const [ account , setAccount ] = React . useState < Account | null | undefined > ( undefined )
2019
2120 const load = React . useCallback ( ( ) => {
22- initServerUrl ( )
2321 getAccount ( ) . then ( ( res ) => {
2422 if ( res . status === "ok" ) {
2523 setAccount ( res . data ?? null )
Original file line number Diff line number Diff line change 11// Server URL — empty string means same-origin (production); localhost gets the backend port
2- export let ServerUrl = ""
3-
4- export function initServerUrl ( ) {
5- if ( typeof window !== "undefined" && window . location . hostname === "localhost" ) {
6- ServerUrl = `http://${ window . location . hostname } :14000`
7- }
8- }
2+ export const ServerUrl =
3+ typeof window !== "undefined" && window . location . hostname === "localhost"
4+ ? `http://${ window . location . hostname } :14000`
5+ : ""
96
107export function getLanguage ( ) : string {
118 if ( typeof localStorage === "undefined" ) return "en"
You can’t perform that action at this time.
0 commit comments