mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
don't create unneeded variables
This commit is contained in:
parent
4bb2e83cb3
commit
d15445a1e0
1 changed files with 11 additions and 11 deletions
|
@ -296,12 +296,11 @@ const serverRequest = async (endpoint, options = {}) => {
|
|||
// if it's a response style with a meta
|
||||
if (result.status !== 200) {
|
||||
if (!forceFreshToken && (!response.meta || response.meta.code === 401)) {
|
||||
// copy options because lint complains if we modify this directly
|
||||
const updatedOptions = options;
|
||||
// force it this time
|
||||
updatedOptions.forceFreshToken = true;
|
||||
// retry with updated options
|
||||
return this.serverRequest(endpoint, updatedOptions);
|
||||
// retry with forcing a fresh token
|
||||
return this.serverRequest(endpoint, {
|
||||
...options,
|
||||
forceFreshToken: true,
|
||||
});
|
||||
}
|
||||
return {
|
||||
err: 'statusCode',
|
||||
|
@ -690,14 +689,15 @@ class LokiAppDotNetServerAPI {
|
|||
}
|
||||
|
||||
// make a request to the server
|
||||
async serverRequest(endpoint, pOptions = {}) {
|
||||
const options = pOptions;
|
||||
options.token = this.token;
|
||||
options.srvPubKey = this.pubKey;
|
||||
async serverRequest(endpoint, options = {}) {
|
||||
if (options.forceFreshToken) {
|
||||
await this.getOrRefreshServerToken(true);
|
||||
}
|
||||
return serverRequest(`${this.baseServerUrl}/${endpoint}`, options);
|
||||
return serverRequest(`${this.baseServerUrl}/${endpoint}`, {
|
||||
...options,
|
||||
token: this.token,
|
||||
srvPubKey: this.pubKey,
|
||||
});
|
||||
}
|
||||
|
||||
async getUserAnnotations(pubKey) {
|
||||
|
|
Loading…
Reference in a new issue