Skip to content

Commit

Permalink
added rest client option
Browse files Browse the repository at this point in the history
  • Loading branch information
imagineeeinc committed Nov 13, 2024
1 parent 6cc35e8 commit 7b23a9b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/lib/components/settings.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<script>
import { navigate } from 'svelte-routing'
import { theme } from '$lib/components/store.js'
import { resetClient } from './store.js';
function reset() {
if (confirm("are you sure you want to reset client?")) {
resetClient()
}
}
</script>

<div id="settings-panel">
Expand All @@ -12,6 +18,7 @@
<option value="dark">Dark</option>
<option value="light">Light</option>
</select>
<button on:click={reset}>Reset Client Data</button>
</div>
</div>
<style>
Expand Down
9 changes: 9 additions & 0 deletions src/lib/components/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export async function authValidity() {
if (res.token == localStorage.getItem('token')) {
return true
}
localStorage.removeItem('token')
return false
}

Expand All @@ -257,4 +258,12 @@ export function availableTags() {
}
})
return get(tags)
}

export function resetClient() {
localStorage.removeItem('notes')
localStorage.removeItem('settings')
localStorage.removeItem('theme')
localStorage.removeItem('token')
location.reload()
}
2 changes: 1 addition & 1 deletion src/lib/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ a:hover {
button {
--width: 46px;
height: var(--width);
width: var(--width);
min-width: var(--width);
padding: 10px;
border: none;
background: var(--bg);
Expand Down

0 comments on commit 7b23a9b

Please sign in to comment.