Skip to content

Commit

Permalink
fix: usePass becomes useAuth. First stage - move
Browse files Browse the repository at this point in the history
  • Loading branch information
davay42 committed Apr 24, 2023
1 parent cd0c2d4 commit 772ee7f
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/auth/composables.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './useAuth'
2 changes: 1 addition & 1 deletion src/user/usePass.ts → src/auth/useAuth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Manage user's password and credentials
* @module Pass
* @module Auth
* @group Users
*/

Expand Down
2 changes: 1 addition & 1 deletion src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'floating-vue/dist/style.css'
import { createApp } from "vue";

import * as Vue from 'vue'
import { gun } from './composables'

import * as components from './all-components'

Expand Down Expand Up @@ -36,6 +35,7 @@ export function createGunVueApp(
App.use(GunVuePlugin)
init(App)
App.mount(tag)
return { Vue, App }
}


Expand Down
1 change: 1 addition & 0 deletions src/composables.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./account/composables"
export * from "./auth/composables"
export * from "./cast/composables"
export * from "./chat/composables"
export * from "./crypto/composables"
Expand Down
14 changes: 3 additions & 11 deletions src/gun/useGun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import "gun/lib/webrtc";


import { relay } from './useRelay'
import { shallowReactive } from 'vue';


// https://github.com/amark/gun/wiki/volunteer.dht
Expand All @@ -26,11 +25,6 @@ import { shallowReactive } from 'vue';
/** The main Gun instance for database operations */
export let gun: IGunInstance;

/** Secondary Gun instance for key management */
let gun2: IGunInstance;

export const gunInstances = shallowReactive([])

/**
* Instantiate a Gun instance for DB manipulations
* @example
Expand All @@ -46,7 +40,6 @@ export function useGun(options: GunOptions = { localStorage: false }): IGunInsta
}
console.log(opts.peers)
gun = Gun(opts);
gunInstances.push(gun)
}
return gun;
}
Expand All @@ -56,10 +49,9 @@ export function useGun(options: GunOptions = { localStorage: false }): IGunInsta
*/

export function useGun2(options: object = { localStorage: false }): IGunInstance {
if (!gun2) {
gun2 = Gun({ peers: [relay.peer], ...options });
gunInstances.push(gun2)
}

const gun2 = Gun({ peers: [relay.peer], ...options });

return gun2;
}

Expand Down
4 changes: 3 additions & 1 deletion src/post/action/PostActionBan.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script setup>
import { ref } from 'vue'
import { gun } from '#composables'
import { useGun } from '#composables'
const props = defineProps({
tag: { type: String, default: '' },
hash: { type: String, default: '' },
host: { type: String, default: '' },
})
const gun = useGun()
const banned = ref(false)
gun.get('ban').get(props.hash).on(d => {
Expand Down
1 change: 0 additions & 1 deletion src/user/composables.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './useUser'
export * from './usePass'
2 changes: 1 addition & 1 deletion src/user/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { gun } from '#composables';
import { reactive, computed } from 'vue'
Expand Down

0 comments on commit 772ee7f

Please sign in to comment.