Skip to content

Commit

Permalink
feat: store current room in storage
Browse files Browse the repository at this point in the history
  • Loading branch information
davay42 committed Apr 29, 2023
1 parent 36b7d72 commit e5728d6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
18 changes: 18 additions & 0 deletions src/room/useRoom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export interface CurrentRoom {
pub: string
isRoot: boolean
hosts?: {
[key: string]: {
enc?: string
features?: string
profile?: string
hosts?: string
}
}
features?: {
[key: string]: string
}
profile?: {
[key: string]: string
}
}
22 changes: 3 additions & 19 deletions src/room/useRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,14 @@ import {
import config from "../../gun.config.json";
import { reactive, computed, ref, watchEffect } from "vue";
import { ISEAPair } from "gun";
import { useStorage } from '@vueuse/core'

const rootRoom = config.room

export interface CurrentRoom {
pub: string
isRoot: boolean
hosts?: {
[key: string]: {
enc?: string
features?: string
profile?: string
hosts?: string
}
}
features?: {
[key: string]: string
}
profile?: {
[key: string]: string
}
}
import { CurrentRoom } from "./useRoom.d";

export const currentRoom: CurrentRoom = reactive({
pub: rootRoom.pub,
pub: useStorage('current-room', rootRoom.pub),
isRoot: computed(() => currentRoom.pub == rootRoom.pub),
hosts: {},
features: {},
Expand Down

0 comments on commit e5728d6

Please sign in to comment.