mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
feat(rn,auth) add support for toekn URL auth
This commit is contained in:
committed by
Saúl Ibarra Corretgé
parent
c19d91a373
commit
dca40dc6cb
@@ -631,3 +631,29 @@ export function appendURLParam(url: string, name: string, value: string) {
|
||||
|
||||
return newUrl.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new hash param to a url string.
|
||||
* Checks whether to use '?' or '&' as a separator (checks for already existing params).
|
||||
*
|
||||
* @param {string} url - The url to modify.
|
||||
* @param {string} name - The param name to add.
|
||||
* @param {string} value - The value for the param.
|
||||
*
|
||||
* @returns {string} - The modified url.
|
||||
*/
|
||||
export function appendURLHashParam(url: string, name: string, value: string) {
|
||||
const newUrl = new URL(url);
|
||||
const dummyUrl = new URL('https://example.com');
|
||||
|
||||
// Copy current hash-parameters without the '#' as search-parameters.
|
||||
dummyUrl.search = newUrl.hash.substring(1);
|
||||
|
||||
// Set or update value with the searchParams-API.
|
||||
dummyUrl.searchParams.append(name, value);
|
||||
|
||||
// Write back as hash parameters.
|
||||
newUrl.hash = dummyUrl.searchParams.toString();
|
||||
|
||||
return newUrl.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user