Pass Additional props remove localstorage related code for storing data and username from App.tsx to index.tsx (#2057)

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Aakansha Doshi
2020-08-26 16:15:54 +05:30
committed by GitHub
parent 0e0a695e81
commit 4718c31da5
6 changed files with 102 additions and 54 deletions

View File

@@ -62,7 +62,7 @@ export const saveUsernameToLocalStorage = (username: string) => {
}
};
export const restoreUsernameFromLocalStorage = (): string | null => {
export const importUsernameFromLocalStorage = (): string | null => {
try {
const data = localStorage.getItem(LOCAL_STORAGE_KEY_COLLAB);
if (data) {
@@ -95,7 +95,7 @@ export const saveToLocalStorage = (
}
};
export const restoreFromLocalStorage = () => {
export const importFromLocalStorage = () => {
let savedElements = null;
let savedState = null;
@@ -131,5 +131,5 @@ export const restoreFromLocalStorage = () => {
// Do nothing because appState is already null
}
}
return restore(elements, appState);
return { elements, appState };
};