feat(features): auth, accounts, home, repositories, issues, notifications
- auth: welcome/connect screens, shared connect form, connect flow, app lock - accounts: session hook, actions, switcher + add-account screens - home: dashboard (identity, shortcuts, recent repos, assigned issues, review requests, activity, unread badge) - repositories/repository: list+search, overview, files, file viewer, commits, commit detail, branches, tags, repo issues/pulls, issue/pull detail - issues/notifications: cross-repo search, query hooks, inbox with read marking and lifecycle-aware polling - settings: theme/language/biometrics/poll interval/cache/about
This commit is contained in:
1 parent
ad81db07b3
commit
0a889ebfed
36 files changed
+4186
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { connectToInstance, type ConnectError, type ConnectInput, type ConnectResult } from './connect';
|
||||
|
||||
export interface UseConnectAccount {
|
||||
connect: (input: ConnectInput) => Promise<ConnectResult | undefined>;
|
||||
connecting: boolean;
|
||||
error: ConnectError | null;
|
||||
reset: () => void;
|
||||
}
|
||||
|
||||
/** React Query mutation wrapper around the connect flow. */
|
||||
export function useConnectAccount(): UseConnectAccount {
|
||||
const mutation = useMutation({
|
||||
mutationFn: connectToInstance,
|
||||
});
|
||||
|
||||
const connect = useCallback(
|
||||
async (input: ConnectInput) => mutation.mutateAsync(input).catch(() => undefined),
|
||||
[mutation],
|
||||
);
|
||||
|
||||
return {
|
||||
connect,
|
||||
connecting: mutation.isPending,
|
||||
error: (mutation.error as ConnectError | null) ?? null,
|
||||
reset: mutation.reset,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user