Use browser build of matrix-js-sdk
This commit is contained in:
parent
9de6629443
commit
e2b5d161cb
2 changed files with 6 additions and 6 deletions
|
@ -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>
|
||||||
|
|
11
src/App.jsx
11
src/App.jsx
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue