(frontend) support 'silent' and 'returnTo' params in authUrl

Enhanced the authentication URL generation to support 'silent'
and 'returnTo' query parameters.

This allows initiating a silent login and specifying a custom
return URL after auth.
This commit is contained in:
lebaudantoine
2024-07-24 22:27:55 +02:00
committed by aleb_the_flash
parent d167490c09
commit 2a8027deb0

View File

@@ -1,5 +1,5 @@
import { apiUrl } from '@/api/apiUrl'
export const authUrl = () => {
return apiUrl('/authenticate')
export const authUrl = (silent = false, returnTo = window.location.href) => {
return apiUrl(`/authenticate?silent=${encodeURIComponent(silent)}&returnTo=${encodeURIComponent(returnTo)}`)
}