Rehydrate client storage after rx.remove_local_storage and rx.remove_cookies (#1998)
This commit is contained in:
parent
e7f0cd8e4c
commit
7b8b64668d
@ -6,7 +6,7 @@ import env from "env.json";
|
|||||||
import Cookies from "universal-cookie";
|
import Cookies from "universal-cookie";
|
||||||
import { useEffect, useReducer, useRef, useState } from "react";
|
import { useEffect, useReducer, useRef, useState } from "react";
|
||||||
import Router, { useRouter } from "next/router";
|
import Router, { useRouter } from "next/router";
|
||||||
|
import { initialEvents } from "utils/context.js"
|
||||||
|
|
||||||
// Endpoint URLs.
|
// Endpoint URLs.
|
||||||
const EVENTURL = env.EVENT
|
const EVENTURL = env.EVENT
|
||||||
@ -146,16 +146,19 @@ export const applyEvent = async (event, socket) => {
|
|||||||
|
|
||||||
if (event.name == "_remove_cookie") {
|
if (event.name == "_remove_cookie") {
|
||||||
cookies.remove(event.payload.key, { ...event.payload.options })
|
cookies.remove(event.payload.key, { ...event.payload.options })
|
||||||
|
queueEvents(initialEvents(), socket)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.name == "_clear_local_storage") {
|
if (event.name == "_clear_local_storage") {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
|
queueEvents(initialEvents(), socket)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.name == "_remove_local_storage") {
|
if (event.name == "_remove_local_storage") {
|
||||||
localStorage.removeItem(event.payload.key);
|
localStorage.removeItem(event.payload.key);
|
||||||
|
queueEvents(initialEvents(), socket)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user