Skip to content

Commit 48062ab

Browse files
committed
feat(#1908): refactored
1 parent 55c410f commit 48062ab

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/core/src/matrix/client/hooks/use-matrix-token.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ export const useMatrixToken = () => {
2222
const endpoint = isLoadingJwt ? null : '/api/matrix/token';
2323

2424
const { data: matrixToken, isLoading } = useSWR(
25-
[endpoint, 'getMatrixToken'],
26-
async ([endpoint]) => {
27-
if (!endpoint) {
25+
[endpoint, jwt, 'getMatrixToken'],
26+
async ([endpoint, authToken]) => {
27+
if (!endpoint || !authToken) {
2828
return undefined;
2929
}
3030
try {
3131
const response = await fetch(endpoint, {
3232
headers: {
33-
...(jwt ? { Authorization: `Bearer ${jwt}` } : undefined),
33+
Authorization: `Bearer ${authToken}`,
3434
},
3535
});
3636
if (!response.ok) {

0 commit comments

Comments
 (0)