Skip to content

Commit

Permalink
#16 Store fact that emwave is connected so we don't hang trying recon…
Browse files Browse the repository at this point in the history
…nect
  • Loading branch information
noah10 committed Dec 20, 2024
1 parent 5b4913a commit 804532e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion client/src/components/ConnectingComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,26 @@
</div>
</template>
<script setup>
import { ref } from 'vue'
import { ref, onBeforeMount } from 'vue'
import { useRouter } from "vue-router"
const router = useRouter()
const connectionError = ref(false)
const connKey = 'emwwaveConnected'
onBeforeMount(() => {
if (window.sessionStorage.getItem(connKey) == 'true') {
router.push({path: '/setup/1'})
}
})
function handleEmWaveStatusEvent(_event, message) {
if (message === 'ConnectionFailure') {
connectionError.value = true
window.sessionStorage.removeItem(connKey)
} else if (message === 'Connected') {
router.push({path: '/setup/1'})
window.sessionStorage.setItem(connKey, 'true')
}
}
Expand Down

0 comments on commit 804532e

Please sign in to comment.