Spaces:
Running
Running
| function b64Encode(obj) { | |
| return btoa(unescape(encodeURIComponent(JSON.stringify(obj)))) | |
| } | |
| function b64Decode(str) { | |
| try { | |
| return JSON.parse(decodeURIComponent(escape(atob(str)))) | |
| } catch { | |
| return null | |
| } | |
| } | |
| export function encodeSessionConfig(config) { | |
| return b64Encode(config) | |
| } | |
| export function decodeSessionConfig(encoded) { | |
| return b64Decode(encoded) | |
| } | |
| export function buildInterviewUrl(sessionId, config) { | |
| const base = `${window.location.origin}${window.location.pathname}` | |
| return `${base}#/interview/${sessionId}?cfg=${b64Encode(config)}` | |
| } | |
| export function buildWatchUrl(sessionId) { | |
| return `${window.location.origin}${window.location.pathname}#/watch/${sessionId}` | |
| } | |