Skip to content

Commit

Permalink
feat(DebugPage): add button for resetting local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
aalemayhu committed May 26, 2024
1 parent 8cd8f43 commit 9856090
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions src/pages/DebugPage/DebugPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { useState } from 'react';
import React, { useState } from 'react';
import { getKeys } from './helpers/getKeys';
import { ErrorPresenter } from '../../components/errors/ErrorPresenter';

export function DebugPage() {
const [show, setShow] = useState(false);

const resetLocalStorage = () => {
localStorage.clear();
window.location.reload();
};

return (
<section className="section">
<h1 className="title">Debug page</h1>
Expand All @@ -17,13 +22,24 @@ export function DebugPage() {
)});\n`
)}
</pre>
<div className="buttons is-justify-content-space-between mt-2">
<div className="control">
<button className="button" type="button" onClick={() => setShow(!show)}>
{show ? 'Hide' : 'Show'}
</button>
{
show && <ErrorPresenter error={new Error('This is a test error')} />
}

</div>

<div className="control">
<button className="button" type="button" onClick={resetLocalStorage}>
Reset local storage
</button>

<button type="button" onClick={() => setShow(!show)}>
{show ? 'Hide' : 'Show'}
</button>
{
show && <ErrorPresenter error={new Error('This is a test error')} />
}
</div>
</div>
</div>
</section>
);
Expand Down

0 comments on commit 9856090

Please sign in to comment.