mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-18 06:24:25 +01:00
update
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { createSignal, onMount, Switch, Match, type Component } from 'solid-js';
|
||||
import { useNavigate } from '@solidjs/router';
|
||||
import useLoginStatus from '@/hooks/useLoginStatus';
|
||||
|
||||
type SignerStatus = 'checking' | 'available' | 'unavailable';
|
||||
|
||||
const Hello: Component = () => {
|
||||
const useSignerStatus = () => {
|
||||
const [signerStatus, setSignerStatus] = createSignal<SignerStatus>('checking');
|
||||
|
||||
const checkStatus = () => {
|
||||
@@ -22,6 +24,25 @@ const Hello: Component = () => {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
return signerStatus;
|
||||
};
|
||||
|
||||
const Hello: Component = () => {
|
||||
const signerStatus = useSignerStatus();
|
||||
const navigate = useNavigate();
|
||||
const { loginStatus, loggedIn } = useLoginStatus();
|
||||
|
||||
const handleLogin = () => {
|
||||
loggedIn();
|
||||
navigate('/');
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
if (loginStatus().loggedIn) {
|
||||
navigate('/');
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<div class="mx-auto flex max-w-[640px] flex-col items-center p-4 text-stone-600">
|
||||
<div class="flex flex-col items-center gap-4 rounded bg-white p-4">
|
||||
@@ -51,7 +72,10 @@ const Hello: Component = () => {
|
||||
</p>
|
||||
</Match>
|
||||
<Match when={signerStatus() === 'available'}>
|
||||
<button class="rounded bg-rose-400 p-4 text-lg font-bold text-white hover:shadow-md">
|
||||
<button
|
||||
class="rounded bg-rose-400 p-4 text-lg font-bold text-white hover:shadow-md"
|
||||
onClick={handleLogin}
|
||||
>
|
||||
NIP-07 拡張機能でログイン
|
||||
</button>
|
||||
</Match>
|
||||
|
||||
Reference in New Issue
Block a user