
Co-authored-by: Krzysztof Żuraw <9116238+krzysztofzuraw@users.noreply.github.com> Co-authored-by: Michał Droń <dron.official@yahoo.com> Co-authored-by: Paweł Chyła <chyla1988@gmail.com>
27 lines
645 B
TypeScript
27 lines
645 B
TypeScript
import { getAppDefaultUri, getAppMountUri } from "@dashboard/config";
|
|
import { stringify } from "qs";
|
|
|
|
export function stringifyQs(params: unknown, arrayFormat?: string): string {
|
|
return stringify(params, {
|
|
arrayFormat: arrayFormat || "indices",
|
|
});
|
|
}
|
|
|
|
export function getArrayQueryParam(
|
|
param: string | string[],
|
|
): string[] | undefined {
|
|
if (!param) {
|
|
return undefined;
|
|
}
|
|
|
|
if (Array.isArray(param)) {
|
|
return param;
|
|
}
|
|
|
|
return [param];
|
|
}
|
|
|
|
export const isExternalURL = url => /^https?:\/\//.test(url);
|
|
|
|
export const getAppMountUriForRedirect = () =>
|
|
getAppMountUri() === getAppDefaultUri() ? "" : getAppMountUri();
|