feat(auth): implement Facebook identity binding on external entry
This commit is contained in:
@@ -239,6 +239,24 @@ export const guestLoginActor = fromPromise<LoginStatus, void>(async () => {
|
||||
return "guest" as LoginStatus;
|
||||
});
|
||||
|
||||
export interface BindFacebookIdentityInput {
|
||||
asid?: string;
|
||||
psid?: string;
|
||||
}
|
||||
|
||||
export const bindFacebookIdentityActor = fromPromise<
|
||||
void,
|
||||
BindFacebookIdentityInput
|
||||
>(async ({ input }) => {
|
||||
const result = await getAuthRepository().bindFacebookIdentity(input);
|
||||
if (Result.isErr(result)) {
|
||||
log.warn(
|
||||
{ err: result.error.message },
|
||||
"[auth-machine] bindFacebookIdentityActor failed",
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// ========== 启动 / 恢复时检查登录态 actor(只查不创) ==========
|
||||
|
||||
export const checkAuthStatusActor = fromPromise<LoginStatus, void>(async () => {
|
||||
@@ -259,17 +277,6 @@ export const checkAuthStatusActor = fromPromise<LoginStatus, void>(async () => {
|
||||
? providerR.data
|
||||
: ("email" as LoginStatus);
|
||||
|
||||
const bindResult = await authRepo.bindFacebookIdentity({
|
||||
asid: asid ?? undefined,
|
||||
psid: psid ?? undefined,
|
||||
});
|
||||
if (Result.isErr(bindResult)) {
|
||||
log.warn(
|
||||
{ err: bindResult.error.message },
|
||||
"[auth-machine] checkAuthStatusActor: bindFacebookIdentity failed",
|
||||
);
|
||||
}
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user