Merge branch 'feat/poc' into feat/datacenter

This commit is contained in:
DiamondThree
2023-01-09 22:00:09 +08:00
2 changed files with 9 additions and 9 deletions

View File

@@ -124,20 +124,19 @@ export class DataCenter {
* login to all providers, it will default run all auth ,
* maybe need a params to control which provider to auth
*/
public async login() {
this.providers.forEach(p => {
// TODO: may be add params of auth
p.auth();
});
public async login(providerId = 'affine') {
const provider = this.providerMap.get(providerId);
assert(provider, `provide '${providerId}' is not registered`);
await provider.auth();
}
/**
* logout from all providers
*/
public async logout() {
this.providers.forEach(p => {
p.logout();
});
public async logout(providerId = 'affine') {
const provider = this.providerMap.get(providerId);
assert(provider, `provide '${providerId}' is not registered`);
await provider.logout();
}
/**

View File

@@ -189,6 +189,7 @@ export const getAuthorizer = () => {
return [signInWithGoogle, onAuthStateChanged] as const;
} catch (e) {
getLogger('getAuthorizer')(e);
return [] as const;
}
};