Skip to content

Commit

Permalink
Merge pull request #92 from getamis/ASL-5124/add-phone-field-in-qubic…
Browse files Browse the repository at this point in the history
…-user

[ASL-5124] add phone field in qubic user
  • Loading branch information
roadmanfong authored Mar 29, 2024
2 parents 5add013 + f1bdb6c commit 301b523
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"tslib": "^2.6.0"
},
"scripts": {
"deploy:payment:dev": "yarn workspace @qubic-connect/payment-form-web deploy:dev",
"build": "lerna run build --scope={'@qubic-connect/redirect,@qubic-connect/detect-iab,@qubic-connect/core'}",
"watch": "lerna run watch --scope={'@qubic-connect/redirect,@qubic-connect/detect-iab,@qubic-connect/core'}",
"release": "npm run build && lerna publish --force-publish",
Expand All @@ -49,4 +48,4 @@
"url": "https://github.com/getamis/qubic-creator-sdk/issues"
},
"homepage": "https://github.com/getamis/qubic-creator-sdk#readme"
}
}
14 changes: 10 additions & 4 deletions packages/core/src/QubicConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ export class QubicConnect {
// user did not install metamask
return;
}
if (!providerOptions.metamask.provider.isMetaMask) {
throw Error('metamask only accept MetaMask provider');
}
}

if (providerOptions.walletconnect) {
Expand Down Expand Up @@ -194,11 +191,14 @@ export class QubicConnect {
provider,
...restUser
} = user;

// do not saved sensitive user data
restUser.qubicUser = null;
localStorage.setItem(USER_STORAGE_KEY, JSON.stringify(restUser));
}
}

private hydrateUser() {
private async hydrateUser() {
const saved = localStorage.getItem(USER_STORAGE_KEY);
if (!saved) return;
try {
Expand All @@ -211,8 +211,14 @@ export class QubicConnect {
if (QubicConnect.ifTokenExpired(user.expiredAt)) {
this.handleLogout(null);
} else {
// login again to get qubicUser data if exists
const {
me: { qubicUser },
} = await getMe(this.marketRequestGraphql);

this.handleLogin(null, {
...user,
qubicUser,
provider,
});
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/api/me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const GET_ME = gql`
qubicUser {
provider
email
phone
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types/QubicUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export enum QubicUserProvider {
export interface QubicUser {
provider: QubicUserProvider;
email: string;
phone: string | null;
}

0 comments on commit 301b523

Please sign in to comment.