fix error on login

This commit is contained in:
Bekbolsun
2024-02-02 18:48:08 +06:00
parent 1c6947d549
commit c5af7d377d
3 changed files with 4 additions and 3 deletions

View File

@@ -64,13 +64,14 @@ export const ModalLogin = () => {
const pubkey = getNpub.names[username]
const npub = nip19.npubEncode(pubkey)
const passphrase = values.password
console.log('fetch', npub, passphrase)
const k: any = await swicCall('fetchKey', npub, passphrase)
notify(`Fetched ${k.npub}`, 'success')
cleanUpStates()
navigate(`/key/${k.npub}`)
} catch (error: any) {
notify(error.message, 'error')
notify(error?.message || 'Something went wrong!', 'error')
}
}

View File

@@ -12,7 +12,7 @@ export const schema = yup.object().shape({
return USERNAME_WITH_DOMAIN_REGEXP.test(value)
})
.required(),
password: yup.string().required(),
password: yup.string().required().min(4),
})
export type FormInputType = yup.InferType<typeof schema>

View File

@@ -273,7 +273,7 @@ export class NoauthBackend {
})
if (r.status !== 200 && r.status !== 201) {
console.log('Fetch error', url, method, r.status)
throw new Error('Failed to fetch' + url)
throw new Error('Failed to fetch ' + url)
}
return await r.json()