feat: allow key enter for sign in (#142)

zio/stable
Shinigami 2022-11-26 19:07:31 +01:00 committed by GitHub
parent 0f0acd4824
commit 39de2c36a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -4,6 +4,9 @@ import { DEFAULT_SERVER } from '~/constants'
let server = $ref<string>('') let server = $ref<string>('')
async function oauth() { async function oauth() {
if (!server)
return
server = server.split('/')[0] server = server.split('/')[0]
location.href = `/api/${server || DEFAULT_SERVER}/login` location.href = `/api/${server || DEFAULT_SERVER}/login`
} }
@ -22,7 +25,7 @@ async function handleInput() {
<div>Mastodon Server Name</div> <div>Mastodon Server Name</div>
<div flex bg-gray:10 px2 py1 mxa rounded border="~ border" text-xl items-center> <div flex bg-gray:10 px2 py1 mxa rounded border="~ border" text-xl items-center>
<span op35 mr1 text-sm>https://</span> <span op35 mr1 text-sm>https://</span>
<input v-model="server" :placeholder="DEFAULT_SERVER" outline-none bg-transparent @input="handleInput"> <input v-model="server" :placeholder="DEFAULT_SERVER" outline-none bg-transparent @input="handleInput" @keyup.enter="oauth()">
</div> </div>
<button btn-solid mt2 @click="oauth()"> <button btn-solid mt2 @click="oauth()">
Sign in Sign in