mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-06 13:55:19 +08:00
Try to migrate from cookies to localStorage
This commit is contained in:
parent
a907d1e584
commit
2945416609
2 changed files with 24 additions and 0 deletions
|
@ -287,6 +287,29 @@ export async function getLanguage(lang) {
|
|||
}
|
||||
}
|
||||
|
||||
export function migrateFromCookies() {
|
||||
["resultFilters", "config", "merchbannerclosed", "activeTags"].forEach(
|
||||
function (name) {
|
||||
let decodedCookie = decodeURIComponent(document.cookie).split(";");
|
||||
let value = null;
|
||||
|
||||
for (var i = 0; i < decodedCookie.length; i++) {
|
||||
var c = decodedCookie[i];
|
||||
while (c.charAt(0) == " ") {
|
||||
c = c.substring(1);
|
||||
}
|
||||
if (c.indexOf(name + "=") == 0) {
|
||||
value = c.substring(name.length + 1, c.length);
|
||||
}
|
||||
}
|
||||
|
||||
if (value) {
|
||||
window.localStorage.setItem(name, value);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function sendVerificationEmail() {
|
||||
Loader.show();
|
||||
let cu = firebase.auth().currentUser;
|
||||
|
|
|
@ -7,6 +7,7 @@ import * as RouteController from "./route-controller";
|
|||
import * as UI from "./ui";
|
||||
|
||||
ManualRestart.set();
|
||||
Misc.migrateFromCookies();
|
||||
UpdateConfig.loadFromLocalStorage();
|
||||
Misc.getReleasesFromGitHub();
|
||||
|
||||
|
|
Loading…
Reference in a new issue