Skip to content

Commit 5d9a3f1

Browse files
committed
refactor: rename TokenSource.generate -> TokenSource.getValue
1 parent 93a44a3 commit 5d9a3f1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/react/src/TokenSource.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export abstract class TokenSourceRefreshable extends TokenSourceConfigurable {
150150
this.cachedResponse = null;
151151
}
152152

153-
async generate(): Promise<TokenSourceResponseObject> {
153+
async getToken(): Promise<TokenSourceResponseObject> {
154154
const unlock = await this.fetchMutex.lock();
155155
try {
156156
if (this.cachedResponse && !isResponseExpired(this.cachedResponse)) {
@@ -181,7 +181,7 @@ export class TokenSourceLiteral extends TokenSourceFixed {
181181
this.literalOrFn = literalOrFn;
182182
}
183183

184-
async generate(): Promise<TokenSourceResponseObject> {
184+
async getToken(): Promise<TokenSourceResponseObject> {
185185
if (typeof this.literalOrFn === 'function') {
186186
return this.literalOrFn();
187187
} else {

packages/react/src/hooks/useSession.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export function useSession(
346346
await Promise.all([
347347
// FIXME: swap the below line in once the new `livekit-client` changes are published
348348
// room.connect(options.credentials),
349-
tokenSource.generate().then(({ serverUrl, participantToken }) => (
349+
tokenSource.getToken().then(({ serverUrl, participantToken }) => (
350350
room.connect(serverUrl, participantToken)
351351
)),
352352

@@ -367,7 +367,7 @@ export function useSession(
367367
}, [room]);
368368

369369
const prepareConnection = useCallback(async () => {
370-
const credentials = await tokenSource.generate();
370+
const credentials = await tokenSource.getToken();
371371
await room.prepareConnection(credentials.serverUrl, credentials.participantToken);
372372
}, [tokenSource, room]);
373373
useEffect(() => {

0 commit comments

Comments
 (0)