mirror of
https://github.com/linkwarden/linkwarden.git
synced 2026-03-03 03:47:02 +00:00
feat(mobile): add loading indicator to buttons
This commit is contained in:
@@ -17,6 +17,7 @@ export default function HomeScreen() {
|
||||
const { auth, signIn } = useAuthStore();
|
||||
const { colorScheme } = useColorScheme();
|
||||
const [method, setMethod] = useState<"password" | "token">("password");
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const [form, setForm] = useState({
|
||||
user: "",
|
||||
@@ -161,12 +162,20 @@ export default function HomeScreen() {
|
||||
<Button
|
||||
variant="accent"
|
||||
size="lg"
|
||||
onPress={() => {
|
||||
isLoading={isLoading}
|
||||
onPress={async () => {
|
||||
if (
|
||||
((form.user && form.password) || form.token) &&
|
||||
form.instance
|
||||
) {
|
||||
signIn(form.user, form.password, form.instance, form.token);
|
||||
setIsLoading(true);
|
||||
await signIn(
|
||||
form.user,
|
||||
form.password,
|
||||
form.instance,
|
||||
form.token
|
||||
);
|
||||
setIsLoading(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -50,6 +50,7 @@ export default function AddLinkSheet() {
|
||||
}
|
||||
)
|
||||
}
|
||||
isLoading={addLink.isPending}
|
||||
variant="accent"
|
||||
className="mb-2"
|
||||
>
|
||||
|
||||
@@ -119,6 +119,7 @@ const Main = (props: SheetProps<"edit-link-sheet">) => {
|
||||
},
|
||||
})
|
||||
}
|
||||
isLoading={editLink.isPending}
|
||||
variant="accent"
|
||||
className="mb-2"
|
||||
>
|
||||
|
||||
@@ -10,10 +10,10 @@ type AuthStore = {
|
||||
username: string,
|
||||
password: string,
|
||||
instance: string,
|
||||
token: string
|
||||
) => void;
|
||||
signOut: () => void;
|
||||
setAuth: () => void;
|
||||
token?: string
|
||||
) => Promise<void>;
|
||||
signOut: () => Promise<void>;
|
||||
setAuth: () => Promise<void>;
|
||||
};
|
||||
|
||||
const useAuthStore = create<AuthStore>((set) => ({
|
||||
|
||||
Reference in New Issue
Block a user