Skip to content

Commit a6a56d3

Browse files
Merge pull request #35 from Geode-solutions/fix_ID
fix(ID): useStorage('ID', '')
2 parents 5771cae + caf8965 commit a6a56d3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

stores/cloud.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { defineStore } from 'pinia'
2+
import { useStorage } from '@vueuse/core'
23

34
export const use_cloud_store = defineStore('cloud', {
45
state: () => ({
5-
ID: '',
6+
ID: useStorage('ID', ''),
67
is_captcha_validated: false,
78
is_cloud_running: false,
89
is_connexion_launched: false,
@@ -31,14 +32,12 @@ export const use_cloud_store = defineStore('cloud', {
3132
async create_connexion () {
3233
if (this.is_connexion_launched) { return }
3334
this.is_connexion_launched = true
34-
const ID = localStorage.getItem('ID')
35-
if (ID === null || typeof ID === 'undefined') {
35+
if (this.ID === '' || this.ID === null || typeof this.ID === 'undefined') {
3636
return this.create_backend()
3737
} else {
3838
const { data, error } = await useFetch(`${this.geode_url}/ping`, { method: 'POST' })
3939
console.log("error", error)
4040
if (data.value !== null) {
41-
this.ID = ID
4241
this.is_cloud_running = true
4342
return this.ping_task()
4443
} else {

0 commit comments

Comments
 (0)