Use browser build of matrix-js-sdk

This commit is contained in:
Robert Long 2021-07-26 11:44:25 -07:00
parent 9de6629443
commit e2b5d161cb
2 changed files with 6 additions and 6 deletions

View file

@ -8,6 +8,7 @@
<script> <script>
window.global = window; window.global = window;
</script> </script>
<script src="/node_modules/matrix-js-sdk/dist/browser-matrix.js"></script>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>

View file

@ -15,7 +15,6 @@ limitations under the License.
*/ */
import React, { useCallback, useEffect, useRef, useState } from "react"; import React, { useCallback, useEffect, useRef, useState } from "react";
import * as sdk from "matrix-js-sdk";
import "./App.css"; import "./App.css";
import { import {
BrowserRouter as Router, BrowserRouter as Router,
@ -91,7 +90,7 @@ function useClient(homeserverUrl) {
if (authStore) { if (authStore) {
const { user_id, device_id, access_token } = JSON.parse(authStore); const { user_id, device_id, access_token } = JSON.parse(authStore);
const client = sdk.createClient({ const client = matrixcs.createClient({
baseUrl: homeserverUrl, baseUrl: homeserverUrl,
accessToken: access_token, accessToken: access_token,
userId: user_id, userId: user_id,
@ -139,12 +138,12 @@ function useClient(homeserverUrl) {
error: undefined, error: undefined,
})); }));
const registrationClient = sdk.createClient(homeserverUrl); const registrationClient = matrixcs.createClient(homeserverUrl);
const { user_id, device_id, access_token } = const { user_id, device_id, access_token } =
await registrationClient.loginWithPassword(username, password); await registrationClient.loginWithPassword(username, password);
const client = sdk.createClient({ const client = matrixcs.createClient({
baseUrl: homeserverUrl, baseUrl: homeserverUrl,
accessToken: access_token, accessToken: access_token,
userId: user_id, userId: user_id,
@ -183,14 +182,14 @@ function useClient(homeserverUrl) {
error: undefined, error: undefined,
})); }));
const registrationClient = sdk.createClient(homeserverUrl); const registrationClient = matrixcs.createClient(homeserverUrl);
const { user_id, device_id, access_token } = const { user_id, device_id, access_token } =
await registrationClient.register(username, password, null, { await registrationClient.register(username, password, null, {
type: "m.login.dummy", type: "m.login.dummy",
}); });
const client = sdk.createClient({ const client = matrixcs.createClient({
baseUrl: homeserverUrl, baseUrl: homeserverUrl,
accessToken: access_token, accessToken: access_token,
userId: user_id, userId: user_id,