mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-26 11:58:53 +00:00
✨(frontend) allow disabling silent login via a URL parameter
Several clients ran into issues with the silent login, leading to redirections that were not appropriate for their use case. Offer a URL parameter to control this behavior and disable silent login when needed.
This commit is contained in:
committed by
aleb_the_flash
parent
ac85a20271
commit
70a296eea6
@@ -8,6 +8,10 @@ and this project adheres to
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- ✨(frontend) allow disabling silent login via a URL parameter
|
||||
|
||||
### Changed
|
||||
|
||||
- ✨(frontend) enhance noise reduction with BBBA audio processing pipeline
|
||||
|
||||
@@ -5,6 +5,16 @@ import { type ApiUser } from './ApiUser'
|
||||
import { useMemo } from 'react'
|
||||
import { useConfig } from '@/api/useConfig'
|
||||
|
||||
const SILENT_LOGIN_PARAM = 'silentLogin'
|
||||
|
||||
const isSilentLoginDisabledByUrl = () => {
|
||||
if (typeof window === 'undefined') return false
|
||||
const value = new URLSearchParams(window.location.search).get(
|
||||
SILENT_LOGIN_PARAM
|
||||
)
|
||||
return value === 'false'
|
||||
}
|
||||
|
||||
/**
|
||||
* returns info about currently logged-in user
|
||||
*
|
||||
@@ -17,16 +27,22 @@ export const useUser = (
|
||||
) => {
|
||||
const { data, isLoading: isConfigLoading } = useConfig()
|
||||
|
||||
const disabledByUrl = useMemo(() => isSilentLoginDisabledByUrl(), [])
|
||||
|
||||
const options = useMemo(() => {
|
||||
if (isConfigLoading) return
|
||||
if (data?.is_silent_login_enabled !== true) {
|
||||
|
||||
const silentDisabled =
|
||||
data?.is_silent_login_enabled !== true || disabledByUrl
|
||||
|
||||
if (silentDisabled) {
|
||||
return {
|
||||
...opts,
|
||||
attemptSilent: false,
|
||||
}
|
||||
}
|
||||
return opts.fetchUserOptions
|
||||
}, [data, opts, isConfigLoading])
|
||||
}, [data, opts, isConfigLoading, disabledByUrl])
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: [keys.user],
|
||||
|
||||
Reference in New Issue
Block a user