Skip to content

Commit

Permalink
Merge pull request #12 from ellielle/fix-login-reactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
ellielle authored Jun 13, 2024
2 parents b2518a7 + c432829 commit ca1f1a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
16 changes: 16 additions & 0 deletions frontend/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,27 @@
import Tabs from "./components/UI/Tabs.svelte";
import { User } from "./stores/user.js";
function updateUserData() {
UserData().then((result) => ($User.userData = result));
}
// FIXME: doesn't run update function
onMount(() => {
// Attempt to log the user on mount by refreshing their
// access token
LoginUserWithToken().then((result) => ($User.isLoggedIn = result));
UserData().then((result) => ($User.userData = result));
// Update user data every 60 seconds
const refreshInterval = setInterval(() => {
if ($User.isLoggedIn) {
updateUserData();
}
}, 60000);
return () => {
clearInterval(refreshInterval);
};
});
</script>

Expand Down
3 changes: 0 additions & 3 deletions frontend/src/components/UI/XPMeter.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<script>
import { User } from "../../stores/user";
export let level;
export let currentXP;
export let levelXP;
// Set stroke-dashoffset to the circumference x percentage of level completed
</script>

<main>
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func main() {
Title: "Boot.dev Buddy",
Width: 900,
Height: 600,
StartHidden: false,
StartHidden: true,
// Set to true to remove border
Frameless: true,
AssetServer: &assetserver.Options{
Expand Down

0 comments on commit ca1f1a8

Please sign in to comment.