Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLA-1840] add account update for sign #131

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions resources/js/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,15 @@ export class AuthApi {

return AuthApi.sendPlatfromRequest(data);
}

static async updateUserAccount(address: string) {
const data = {
query: mutations.UpdateUser,
variables: {
address,
},
};

return AuthApi.sendPlatfromRequest(data);
}
}
7 changes: 6 additions & 1 deletion resources/js/components/SignTransaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
import { DialogTitle } from '@headlessui/vue';
import Btn from './Btn.vue';
import Modal from './Modal.vue';
import { addressShortHex } from '~/util/address';
import { addressShortHex, publicKeyToAddress } from '~/util/address';
import { useTransactionStore } from '~/store/transaction';
import { ref } from 'vue';
import LoadingCircle from './LoadingCircle.vue';
Expand Down Expand Up @@ -116,6 +116,11 @@ const selectAccount = async (account) => {
isLoading.value = true;
await connectionStore.setAccount(account);
signing.value = true;

// Update user wallet account if multi-tenant
if (useAppStore().isMultiTenant) {
await useAppStore().updateUserAccount(publicKeyToAddress(account.address));
}
const res = await transactionStore.signTransaction(props.transaction);
if (res) {
emit('success');
Expand Down
4 changes: 2 additions & 2 deletions resources/js/graphql/mutation/auth/UpdateUser.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default `mutation UpdateUser($email: String, $password: String) {
UpdateUser(email: $email, password: $password)
export default `mutation UpdateUser($email: String, $password: String, $account: String) {
UpdateUser(email: $email, password: $password, account: $account)
}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This attribute is dedicated for wallet daemon and we cannot update this. I created a new attribute for this in this PR https://github.com/enjin/platform-multi-tenant/pull/72

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay thank you! will check the new implementation

3 changes: 3 additions & 0 deletions resources/js/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ export const useAppStore = defineStore('app', {
this.user.apiTokens = this.user.apiTokens.filter((token) => token.name !== name);
this.tokensCount = this.user.apiTokens.length;
},
async updateUserAccount(address: string) {
await AuthApi.updateUserAccount(address);
},
setURL(url: string) {
this.url = new URL(url);
this.config.url = new URL(url);
Expand Down
Loading