fix window checks for SSR
This commit is contained in:
parent
b70dbeb6d6
commit
49cf1f2e23
|
@ -70,10 +70,10 @@ export async function listLocalStorages ({ userId, database }) {
|
||||||
*/
|
*/
|
||||||
function createMemBackend (userId, namespace) {
|
function createMemBackend (userId, namespace) {
|
||||||
const joinedNamespace = userId + ':' + namespace.join(':')
|
const joinedNamespace = userId + ':' + namespace.join(':')
|
||||||
let memory = window?.snMemStorage?.[joinedNamespace]
|
let memory = typeof window !== 'undefined' ? window?.snMemStorage?.[joinedNamespace] : null
|
||||||
if (!memory) {
|
if (!memory) {
|
||||||
memory = {}
|
memory = {}
|
||||||
if (window) {
|
if (typeof window !== 'undefined') {
|
||||||
if (!window.snMemStorage) window.snMemStorage = {}
|
if (!window.snMemStorage) window.snMemStorage = {}
|
||||||
window.snMemStorage[joinedNamespace] = memory
|
window.snMemStorage[joinedNamespace] = memory
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue