|
|
@ -3,6 +3,7 @@ import { makeAutoObservable } from "mobx";
|
|
|
|
import { authServiceClient, inboxServiceClient, userServiceClient } from "@/grpcweb";
|
|
|
|
import { authServiceClient, inboxServiceClient, userServiceClient } from "@/grpcweb";
|
|
|
|
import { Inbox } from "@/types/proto/api/v1/inbox_service";
|
|
|
|
import { Inbox } from "@/types/proto/api/v1/inbox_service";
|
|
|
|
import { Shortcut, User, UserSetting, UserStats } from "@/types/proto/api/v1/user_service";
|
|
|
|
import { Shortcut, User, UserSetting, UserStats } from "@/types/proto/api/v1/user_service";
|
|
|
|
|
|
|
|
import { findNearestMatchedLanguage } from "@/utils/i18n";
|
|
|
|
import workspaceStore from "./workspace";
|
|
|
|
import workspaceStore from "./workspace";
|
|
|
|
|
|
|
|
|
|
|
|
class LocalState {
|
|
|
|
class LocalState {
|
|
|
@ -223,7 +224,11 @@ export const initialUserStore = async () => {
|
|
|
|
appearance: userSetting.appearance,
|
|
|
|
appearance: userSetting.appearance,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} catch {
|
|
|
|
} catch {
|
|
|
|
// Do nothing.
|
|
|
|
// find the nearest matched lang based on the `navigator.language` if the user is unauthenticated or settings retrieval fails.
|
|
|
|
|
|
|
|
const locale = findNearestMatchedLanguage(navigator.language);
|
|
|
|
|
|
|
|
workspaceStore.state.setPartial({
|
|
|
|
|
|
|
|
locale: locale,
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|