Skip to content

Commit

Permalink
Revert "Extract getLocalStorageUser() in WebComponentLoader"
Browse files Browse the repository at this point in the history
This reverts commit 4be26c8.

This was in preparation for fixing a problem that has now been more
effectively addressed in this editor-api PR [1].

[1]: RaspberryPiFoundation/editor-api#337.
  • Loading branch information
floehopper committed Jun 20, 2024
1 parent 9ef4c95 commit 56cc805
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/containers/WebComponentLoader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,13 @@ const WebComponentLoader = (props) => {
useEditorStyles = false, // If true use the standard editor styling for the web component
} = props;

const getLocalStorageUser = (authKey) => {
if (authKey) {
const user = JSON.parse(localStorage.getItem(authKey));
if (user) {
return user;
} else {
return null;
}
} else {
return null;
}
};

const dispatch = useDispatch();
const { t } = useTranslation();
const [projectIdentifier, setProjectIdentifier] = useState(identifier);
localStorage.setItem("authKey", authKey);
const localStorageUser = getLocalStorageUser(authKey);
const localStorageUser = authKey
? JSON.parse(localStorage.getItem(authKey))
: null;
const user = useSelector((state) => state.auth.user || localStorageUser);
const [loadCache, setLoadCache] = useState(!!!user);
const [loadRemix, setLoadRemix] = useState(!!user);
Expand Down

0 comments on commit 56cc805

Please sign in to comment.