Spaces:
Sleeping
Sleeping
File size: 703 Bytes
d867e05 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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}`
}
|