Skip to content

Commit 6123314

Browse files
lint
1 parent a5233b9 commit 6123314

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

src/components/Page/Index.vue

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ import {
2525
hasWritePermission,
2626
} from '../../fixtures/memberships'
2727
import { JsonRpcProvider } from 'ethers'
28-
import { getSignature, getMessage, checkSession, consoleWarn } from '../../fixtures/session'
28+
import {
29+
getSignature,
30+
getMessage,
31+
checkSession,
32+
consoleWarn,
33+
} from '../../fixtures/session'
2934
import { Strings } from '../../i18n'
3035
3136
type Props = {
@@ -123,10 +128,10 @@ const handleConnection = async (signer: UndefinedOr<Signer>) => {
123128
const connectedAddress = signer
124129
? await signer.getAddress()
125130
: await newSigner.getAddress()
126-
131+
127132
walletAddress.value = connectedAddress
128133
129-
if(isVerified.value){
134+
if (isVerified.value) {
130135
hasEditableRole.value = await testPermission(
131136
walletAddress.value,
132137
new JsonRpcProvider(props.rpcUrl),
@@ -177,14 +182,14 @@ onMounted(async () => {
177182
'@devprotocol/clubs-core/connection'
178183
)
179184
connection.value = conct
180-
conct().signer.subscribe(async(signer: UndefinedOr<Signer>) => {
185+
conct().signer.subscribe(async (signer: UndefinedOr<Signer>) => {
181186
if (signer) {
182-
const connectedAddress = await signer.getAddress()
183-
walletAddress.value = connectedAddress
184-
isVerified.value = await checkSession(connectedAddress)
185-
console.log( "isverfied", isVerified.value )
186-
walletSigner = signer
187-
handleConnection(signer)
187+
const connectedAddress = await signer.getAddress()
188+
walletAddress.value = connectedAddress
189+
isVerified.value = await checkSession(connectedAddress)
190+
console.log('isverfied', isVerified.value)
191+
walletSigner = signer
192+
handleConnection(signer)
188193
}
189194
})
190195
i18n.value = i18nBase(navigator.languages)
@@ -193,7 +198,7 @@ onMounted(async () => {
193198
const isVerified = ref(false)
194199
195200
const handleVerify = async () => {
196-
const walletAddres = await walletSigner?.getAddress() as string
201+
const walletAddres = (await walletSigner?.getAddress()) as string
197202
const hash = getMessage(walletAddres)
198203
let sig = await getSignature(walletAddres, walletSigner as Signer)
199204
fetchPosts({ hash, sig })

src/fixtures/session.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,26 @@ export const getSessionAddress = async (hash: string, sig: string) => {
4949
export const checkSession = async (address: string) => {
5050
console.log('inside checkSession')
5151
const hash = sessionStorage.getItem(`hash-of-${address}`)
52-
const sigItem = sessionStorage.getItem(`sig-of-${address}`);
53-
const sig = sigItem ? decode(sigItem) as string : undefined;
54-
console.log({hash, sig})
52+
const sigItem = sessionStorage.getItem(`sig-of-${address}`)
53+
const sig = sigItem ? (decode(sigItem) as string) : undefined
54+
console.log({ hash, sig })
5555

5656
if (!hash || !sig) {
57-
return false;
57+
return false
5858
}
5959

60-
try{
60+
try {
6161
const SessoionAddress = await getSessionAddress(hash, sig)
62-
console.log({SessoionAddress, address})
62+
console.log({ SessoionAddress, address })
6363

6464
if (SessoionAddress !== address) {
6565
console.log('inside here')
6666
return false
6767
}
6868
return true
69-
}
70-
catch(error) {
69+
} catch (error) {
7170
console.log('inside catch')
72-
console.error('Error checking session:', error);
71+
console.error('Error checking session:', error)
7372
return false
7473
}
7574
}

0 commit comments

Comments
 (0)