我正在构建一个带有 UI 并TypeScript与UIxState相结合的登录机器React。
我的机器是:
import { LoginResponse } from 'async/authentication/responseModel';
import Data from 'data';
import { AUTH_TOKEN } from 'Machines/authentication/constants';
import services from 'services';
import { assign, DoneInvokeEvent, Interpreter, Machine, MachineConfig, State } from 'xstate';
export type AutomataContext = {
authentication: {
oldToken: {
exists: boolean;
token: string;
};
token: string;
};
login: {
email: string;
password: string;
};
};
export interface AutomataStatesSchema {
states: {
SEARCHING_EXISTING_AUTH_TOKEN: {};
VERIFYING_EXISTING_TOKEN: {};
LOGIN_VIEW: {};
AUTHENTICATING: {}; …Run Code Online (Sandbox Code Playgroud)