mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +00:00
Add homeserver to token login
Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
@@ -153,7 +153,7 @@ interface Props {
|
|||||||
|
|
||||||
export const ClientProvider: FC<Props> = ({ children }) => {
|
export const ClientProvider: FC<Props> = ({ children }) => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { token, userId, deviceId } = useUrlParams();
|
const { token, userId, deviceId, baseUrl } = useUrlParams();
|
||||||
// null = signed out, undefined = loading
|
// null = signed out, undefined = loading
|
||||||
const [initClientState, setInitClientState] = useState<
|
const [initClientState, setInitClientState] = useState<
|
||||||
InitResult | null | undefined
|
InitResult | null | undefined
|
||||||
@@ -173,13 +173,19 @@ export const ClientProvider: FC<Props> = ({ children }) => {
|
|||||||
token,
|
token,
|
||||||
userId,
|
userId,
|
||||||
deviceId,
|
deviceId,
|
||||||
} as { token: string; userId: string });
|
homeserver: baseUrl,
|
||||||
|
} as {
|
||||||
|
token: string;
|
||||||
|
userId: string;
|
||||||
|
deviceId: string;
|
||||||
|
homeserver: string;
|
||||||
|
});
|
||||||
|
|
||||||
loadClient(tokenLogin)
|
loadClient(tokenLogin)
|
||||||
.then(setInitClientState)
|
.then(setInitClientState)
|
||||||
.catch((err) => logger.error(err))
|
.catch((err) => logger.error(err))
|
||||||
.finally(() => (initializing.current = false));
|
.finally(() => (initializing.current = false));
|
||||||
}, [token, userId, deviceId]);
|
}, [token, userId, deviceId, baseUrl]);
|
||||||
|
|
||||||
const changePassword = useCallback(
|
const changePassword = useCallback(
|
||||||
async (password: string) => {
|
async (password: string) => {
|
||||||
@@ -352,6 +358,7 @@ async function loadClient(tokenLogin?: {
|
|||||||
token: string;
|
token: string;
|
||||||
userId: string;
|
userId: string;
|
||||||
deviceId: string;
|
deviceId: string;
|
||||||
|
homeserver: string;
|
||||||
}): Promise<InitResult | null> {
|
}): Promise<InitResult | null> {
|
||||||
if (widget) {
|
if (widget) {
|
||||||
// We're inside a widget, so let's engage *matryoshka mode*
|
// We're inside a widget, so let's engage *matryoshka mode*
|
||||||
@@ -383,7 +390,7 @@ async function loadClient(tokenLogin?: {
|
|||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
const { user_id, device_id, access_token, passwordlessUser } = session;
|
const { user_id, device_id, access_token, passwordlessUser } = session;
|
||||||
const initClientParams = {
|
const initClientParams = {
|
||||||
baseUrl: Config.defaultHomeserverUrl()!,
|
baseUrl: tokenLogin?.homeserver ?? Config.defaultHomeserverUrl()!,
|
||||||
accessToken: access_token,
|
accessToken: access_token,
|
||||||
userId: user_id,
|
userId: user_id,
|
||||||
deviceId: device_id,
|
deviceId: device_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user