14 lines
323 B
TypeScript
14 lines
323 B
TypeScript
export function buildEventPath(token: string | null, path: string): string {
|
|
const normalized = path.startsWith('/') ? path : `/${path}`;
|
|
|
|
if (!token) {
|
|
return normalized;
|
|
}
|
|
|
|
if (normalized === '/') {
|
|
return `/e/${encodeURIComponent(token)}`;
|
|
}
|
|
|
|
return `/e/${encodeURIComponent(token)}${normalized}`;
|
|
}
|