diff --git a/packages/auth/src/services/auth.js b/packages/auth/src/services/auth.js index d54e8b9..1302153 100644 --- a/packages/auth/src/services/auth.js +++ b/packages/auth/src/services/auth.js @@ -102,8 +102,8 @@ const build = async ({ seed, authMemberId, rpcEndpoint }) => { throw new Error('already registered') } //TODO: change member owner to API - const { id: member_id, data: { role } } = await members.create({ wallet: iss, role: NEW_ROLE }) - const registered = await wallets.create({ member_id, nickname }, { id: iss, owner: member_id }) + const { id: memberId, data: { role } } = await members.create({ wallet: iss, role: NEW_ROLE }) + const registered = await wallets.create({ memberId, nickname }, { id: iss, owner: memberId }) const authPayload = jwtService.authPayload({ iss, nickname, role }) return jwtService.createJwt(wallet, jwtService.AUTH_JWT, authPayload) @@ -117,11 +117,12 @@ const build = async ({ seed, authMemberId, rpcEndpoint }) => { if (!exists) { member = await members.create({ wallet: iss, role: NEW_ROLE, groupIds: DEFAULT_GROUP_IDS }) await members.updateMeta(member.id, { owner: member.id }) - const { id: member_id, data: { role } } = member - await wallets.create({ member_id, nickname }, { id: iss, owner: member_id }) + const { id: memberId, data: { role } } = member + await wallets.create({ memberId, nickname }, { id: iss, owner: memberId }) } else { - const { data: { member_id } } = await wallets.get(iss) - member = await members.get(member_id) + // TODO: migrate entities from member_id to memberId + const { data: { member_id, memberId } } = await wallets.get(iss) + member = await members.get(memberId || member_id) // TODO: quick fix to migrate legacy member entities await members.updateMeta(member.id, { owner: member.id }) } diff --git a/packages/wallet/src/components/Create.jsx b/packages/wallet/src/components/Create.jsx index 558ab67..0f6b680 100644 --- a/packages/wallet/src/components/Create.jsx +++ b/packages/wallet/src/components/Create.jsx @@ -65,7 +65,7 @@ const Create = () => { wallet = null // TODO: retry? - await client.call({ method: 'authService.register', params: [jwt] }) + await client.call({ method: 'authService.accessToken', params: [jwt, true] }) } catch (error) { console.error(error) setErrorMessage(error.message) diff --git a/packages/wallet/src/components/Import.jsx b/packages/wallet/src/components/Import.jsx index 51b1316..bdd3c94 100644 --- a/packages/wallet/src/components/Import.jsx +++ b/packages/wallet/src/components/Import.jsx @@ -66,7 +66,7 @@ const Import = () => { wallet = null // TODO: retry? - await client.call({ method: 'authService.register', params: [jwt] }) + await client.call({ method: 'authService.accessToken', params: [jwt, true] }) } catch (error) { setErrorMessage(error.message) console.error(error)