mirror of
https://github.com/gramps-project/gramps-web.git
synced 2026-01-06 05:40:09 -06:00
This commit is contained in:
@@ -529,7 +529,7 @@ export class GrampsJs extends LitElement {
|
||||
this._handleVisibilityChange()
|
||||
)
|
||||
window.addEventListener('online', () => this._handleOnline())
|
||||
window.addEventListener('token:refresh', () => this._handleRefresh())
|
||||
window.addEventListener('token:refresh', () => this._handleRefresh(true))
|
||||
|
||||
if (window.location.pathname.includes('/oidc/complete')) {
|
||||
return
|
||||
@@ -822,8 +822,8 @@ export class GrampsJs extends LitElement {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
async _handleRefresh() {
|
||||
await this.appState.refreshTokenIfNeeded()
|
||||
async _handleRefresh(force = false) {
|
||||
await this.appState.refreshTokenIfNeeded(force)
|
||||
this.setPermissions()
|
||||
}
|
||||
|
||||
|
||||
@@ -678,8 +678,8 @@ export class Auth {
|
||||
return localStorage.getItem('refresh_token')
|
||||
}
|
||||
|
||||
async getValidAccessToken() {
|
||||
if (this._shouldRefresh()) {
|
||||
async getValidAccessToken(force = false) {
|
||||
if (force || this._shouldRefresh()) {
|
||||
if (this._refreshingTokens) {
|
||||
// If already refreshing, wait for that to finish
|
||||
await this._refreshingTokens
|
||||
|
||||
@@ -41,7 +41,7 @@ export function getInitialAppState() {
|
||||
apiPutPostDeleteNew(auth, 'PUT', endpoint, payload, options),
|
||||
apiDelete: (endpoint, options = {}) =>
|
||||
apiPutPostDeleteNew(auth, 'DELETE', endpoint, {}, options),
|
||||
refreshTokenIfNeeded: () => auth.getValidAccessToken(),
|
||||
refreshTokenIfNeeded: (force = false) => auth.getValidAccessToken(force),
|
||||
signout: () => auth.signout(),
|
||||
updateSettings: (settings = {}, tree = false) =>
|
||||
updateSettings(settings, tree),
|
||||
|
||||
Reference in New Issue
Block a user