⚡ (chat) Improve chat API compatibility with preview mode
This commit is contained in:
17
packages/js/src/utils/sessionStorage.ts
Normal file
17
packages/js/src/utils/sessionStorage.ts
Normal file
@ -0,0 +1,17 @@
|
||||
const sessionStorageKey = 'resultId'
|
||||
|
||||
export const getExistingResultIdFromSession = () => {
|
||||
try {
|
||||
return sessionStorage.getItem(sessionStorageKey) ?? undefined
|
||||
} catch {
|
||||
/* empty */
|
||||
}
|
||||
}
|
||||
|
||||
export const setResultInSession = (resultId: string) => {
|
||||
try {
|
||||
return sessionStorage.setItem(sessionStorageKey, resultId)
|
||||
} catch {
|
||||
/* empty */
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user