Skip to content

Commit e89cf39

Browse files
code cleanup
1 parent 780b625 commit e89cf39

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

components/Launcher.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
watch(is_captcha_validated, async (value) => {
3131
if (value === true && process.client) {
3232
await infra_store.create_backend()
33-
await viewer_store.connect()
33+
await viewer_store.ws_connect()
3434
}
3535
})
3636
</script>

stores/infra.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,11 @@ export const use_infra_store = defineStore("infra", {
4747
},
4848
actions: {
4949
async create_backend() {
50-
console.log("create_backend", this.status)
5150
if (this.status === Status.CREATED) return
52-
console.log("NAVIGATOR", navigator)
5351
navigator.locks.request("infra.create_backend", async (lock) => {
54-
console.log("PASSED IN LOCK", this.status)
5552
this.status = Status.CREATING
5653
if (this.status === Status.CREATED) return
57-
console.log("INFRA LOCK GRANTED !", lock)
58-
console.log("INFRA STATUS", this.status)
54+
console.log("LOCK GRANTED !", lock)
5955
const geode_store = use_geode_store()
6056
const viewer_store = use_viewer_store()
6157
const feedback_store = use_feedback_store()

stores/viewer.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ export const use_viewer_store = defineStore("viewer", {
5858
},
5959
async ws_connect() {
6060
if (process.env.NODE_ENV == "test") return
61-
console.log("ws_connect 1", this.status)
6261
if (this.status === Status.CONNECTED) return
63-
console.log("ws_connect 2", this.status)
64-
6562
navigator.locks.request("viewer.ws_connect", async (lock) => {
6663
console.log("VIEWER STATUS", this.status)
6764
if (this.status === Status.CONNECTED) return

test/stores/Infra.nuxt.test.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,14 @@ const mockLockRequest = vi.fn().mockImplementation(async (name, callback) => {
99
return callback({ name })
1010
})
1111

12-
vi.stubGlobal('navigator', {
12+
vi.stubGlobal("navigator", {
1313
...navigator,
1414
locks: {
15-
request: mockLockRequest
16-
}
15+
request: mockLockRequest,
16+
},
1717
})
1818

1919
describe("Infra Store", () => {
20-
// const locksMock = {
21-
// locks: { request: vi.fn() },
22-
// }
23-
// global.navigator = locksMock // here
24-
2520
const pinia = createTestingPinia({
2621
stubActions: false,
2722
})

0 commit comments

Comments
 (0)