mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-11-20 03:25:52 +01:00
Add ability to adjust the token on the homeserver API.
This commit is contained in:
parent
7b35a25627
commit
15fd73ed9c
@ -1094,6 +1094,15 @@ export class Session {
|
||||
return body.room_id;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the access token used by the API. Does NOT
|
||||
* change the token in storage.
|
||||
* @param {string} token
|
||||
*/
|
||||
updateAccessToken(token) {
|
||||
this._hsApi.updateAccessToken(token);
|
||||
}
|
||||
}
|
||||
|
||||
import {FeatureSet} from "../features";
|
||||
|
@ -46,7 +46,7 @@ type BaseRequestOptions = {
|
||||
|
||||
export class HomeServerApi {
|
||||
private readonly _homeserver: string;
|
||||
private readonly _accessToken: string;
|
||||
private _accessToken: string;
|
||||
private readonly _requestFn: RequestFunction;
|
||||
private readonly _reconnector: Reconnector;
|
||||
|
||||
@ -125,6 +125,14 @@ export class HomeServerApi {
|
||||
return this._authedRequest("GET", this._url(csPath, options?.prefix || CS_R0_PREFIX), queryParams, body, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the access token used by the API.
|
||||
* @param token
|
||||
*/
|
||||
public updateAccessToken(token: string) {
|
||||
this._accessToken = token;
|
||||
}
|
||||
|
||||
sync(since: string, filter: string, timeout: number, options?: BaseRequestOptions): IHomeServerRequest {
|
||||
return this._get("/sync", {since, timeout, filter}, undefined, options);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user