@coopenomics/desktop 2025.5.5 → 2025.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/entities/Registrator/model/store.ts +15 -11
- package/src/features/Agreementer/SignAgreementDialog/model/index.ts +5 -3
- package/src/features/Agreementer/SignAgreementDialog/ui/SignAgreementDialog.vue +1 -1
- package/src/features/Decision/AuthorizeAndExecDecision/model/index.ts +6 -9
- package/src/features/Decision/CreateProject/model/index.ts +1 -1
- package/src/features/Decision/VoteAgainstDecision/model/index.ts +14 -2
- package/src/features/Decision/VoteForDecision/model/index.ts +9 -5
- package/src/features/FreeDecision/CreateProject/model/index.ts +1 -1
- package/src/features/Meet/CloseMeetWithDecision/model/index.ts +13 -13
- package/src/features/Meet/CreateMeet/model/index.ts +1 -1
- package/src/features/Meet/RestartMeet/model/index.ts +6 -3
- package/src/features/Request/AcceptRequest/api/index.ts +3 -10
- package/src/features/Request/ConfirmRecieveOnRequest/api/index.ts +4 -9
- package/src/features/Request/ConfirmSupplyOnRequest/api/index.ts +6 -11
- package/src/features/Request/ConfirmSupplyOnRequest/ui/ConfirmSupplyOnRequestButton.vue +1 -1
- package/src/features/Request/CreateChildOrder/model/index.ts +35 -30
- package/src/features/Request/CreateChildOrder/ui/CreateChildOrderButton/CreateChildOrderButton.vue +20 -15
- package/src/features/Request/DisputeOnRequest/api/index.ts +19 -24
- package/src/features/Request/DisputeOnRequest/ui/DisputeOnRequestButton.vue +1 -1
- package/src/features/Request/RecieveOnRequest/api/index.ts +6 -11
- package/src/features/Request/RecieveOnRequest/ui/RecieveOnRequestButton.vue +1 -1
- package/src/features/Request/SupplyOnRequest/api/index.ts +18 -27
- package/src/features/Union/AddCooperative/ui/AddCooperativeForm.vue +7 -5
- package/src/features/User/CreateUser/api/index.ts +28 -10
- package/src/features/User/CreateUser/model/index.ts +39 -31
- package/src/pages/Cooperative/ListOfAgenda/ui/ListOfAgendaQuestions.vue +8 -8
- package/src/pages/Cooperative/ListOfParticipants/ui/ListOfParticipantsPage.vue +3 -3
- package/src/pages/Registrator/SignUp/EmailInput.vue +0 -7
- package/src/pages/Union/ConnectionAgreement/ConnectionAgreementPage.vue +1 -1
- package/src/processes/process-decisions/index.ts +32 -29
- package/src/processes/select-branch/index.ts +1 -1
- package/src/shared/api/indexDB.ts +0 -1
- package/src/shared/lib/document/model/const.ts +30 -0
- package/src/shared/lib/document/model/entity.ts +33 -21
- package/src/shared/lib/document/model/index.ts +1 -1
- package/src/shared/lib/document/model/types.ts +2 -3
- package/src/shared/lib/types/document/index.ts +11 -13
- package/src/shared/lib/types/user/IUserData.ts +5 -6
- package/src/shared/lib/types/user/index.ts +1 -11
- package/src/shared/store/index.ts +9 -5
- package/src/shared/ui/BaseDocument/BaseDocument.vue +43 -42
- package/src/shared/ui/ComplexDocument/ComplexDocument.vue +7 -5
- package/src/shared/ui/ZodForm/ZodForm.vue +1 -1
- package/src/widgets/Cooperative/Documents/ListOfDocuments/ui/DocumentsTable.vue +2 -2
- package/src/widgets/Meets/MeetDetailsVoting/model.ts +4 -4
- package/src/widgets/Participants/ui/ParticipantCard.vue +3 -3
- package/src/widgets/Participants/ui/ParticipantDetails.vue +6 -6
- package/src/widgets/Participants/ui/ParticipantsTable.vue +3 -3
- package/src/widgets/Questions/ui/QuestionsTable/QuestionsTable.vue +8 -8
@@ -5,34 +5,29 @@ import { ContractsList } from 'src/shared/config';
|
|
5
5
|
import { useRequestStore } from 'src/entities/Request/model/stores';
|
6
6
|
import { IUpdateOneRequest } from 'src/entities/Request';
|
7
7
|
import { MarketContract } from 'cooptypes';
|
8
|
-
import {
|
8
|
+
import { fakeDocument } from 'src/shared/lib/document/model/const';
|
9
9
|
|
10
|
-
async function
|
10
|
+
async function disputeOnRequest(
|
11
11
|
params: IDisputeOnRequest
|
12
12
|
): Promise<TransactResult | undefined> {
|
13
|
-
//TODO здесь нужно получить подписанный документ
|
14
|
-
const document =
|
15
|
-
hash: '33CBC662E606F23F332B442BAB84F2D05BD498B66EF61BC918740606B05BD565',
|
16
|
-
public_key: 'PUB_K1_8YWRWjCdUQubPoHzT5ndvfhGKDf1ZL7v7Ge9iHoLtNp7wnVfG1',
|
17
|
-
signature: 'SIG_K1_KWeGQ48n78ybpkuVDf1M7nuGnT8pkPXFbYYMUXtFTFv2dEReMEmwW89r19dKmAVSFZwHTdxdqkB3ZQJeAS9CcQwb92E398',
|
18
|
-
meta: '',
|
19
|
-
} as IDocument;
|
13
|
+
//TODO здесь нужно получить подписанный документ спора и подставить
|
14
|
+
const document = fakeDocument;
|
20
15
|
|
21
16
|
const result = await transact({
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
17
|
+
account: ContractsList.Marketplace,
|
18
|
+
name: MarketContract.Actions.OpenDispute.actionName,
|
19
|
+
authorization: [
|
20
|
+
{
|
21
|
+
actor: params.username,
|
22
|
+
permission: 'active',
|
23
|
+
},
|
24
|
+
],
|
25
|
+
data: {
|
26
|
+
username: params.username,
|
27
|
+
coopname: params.coopname,
|
28
|
+
exchange_id: params.request_id,
|
29
|
+
document: {...document, meta: JSON.stringify(document.meta)},
|
30
|
+
} as MarketContract.Actions.OpenDispute.IOpenDispute,
|
36
31
|
});
|
37
32
|
|
38
33
|
const requestsStore = useRequestStore();
|
@@ -45,5 +40,5 @@ async function dispute(
|
|
45
40
|
}
|
46
41
|
|
47
42
|
export const api = {
|
48
|
-
|
43
|
+
disputeOnRequest,
|
49
44
|
};
|
@@ -4,19 +4,14 @@ import { transact } from 'src/shared/api';
|
|
4
4
|
import { ContractsList } from 'src/shared/config';
|
5
5
|
import { useRequestStore } from 'src/entities/Request/model/stores';
|
6
6
|
import { IUpdateOneRequest } from 'src/entities/Request';
|
7
|
-
import { IDocument } from 'src/shared/lib/types/document';
|
8
7
|
import { MarketContract } from 'cooptypes';
|
8
|
+
import { fakeDocument } from 'src/shared/lib/document/model/const';
|
9
9
|
|
10
|
-
async function
|
10
|
+
async function recieveOnRequest(
|
11
11
|
params: IRecieveOnRequest
|
12
12
|
): Promise<TransactResult | undefined> {
|
13
|
-
//TODO здесь нужно получить подписанный документ (
|
14
|
-
const document =
|
15
|
-
hash: '33CBC662E606F23F332B442BAB84F2D05BD498B66EF61BC918740606B05BD565',
|
16
|
-
public_key: 'PUB_K1_8YWRWjCdUQubPoHzT5ndvfhGKDf1ZL7v7Ge9iHoLtNp7wnVfG1',
|
17
|
-
signature: 'SIG_K1_KWeGQ48n78ybpkuVDf1M7nuGnT8pkPXFbYYMUXtFTFv2dEReMEmwW89r19dKmAVSFZwHTdxdqkB3ZQJeAS9CcQwb92E398',
|
18
|
-
meta: '',
|
19
|
-
} as IDocument;
|
13
|
+
//TODO здесь нужно получить подписанный документ (накладная) и подставить
|
14
|
+
const document = fakeDocument;
|
20
15
|
|
21
16
|
const result = await transact({
|
22
17
|
account: ContractsList.Marketplace,
|
@@ -31,7 +26,7 @@ async function recieve(
|
|
31
26
|
username: params.username,
|
32
27
|
coopname: params.coopname,
|
33
28
|
exchange_id: params.request_id,
|
34
|
-
document,
|
29
|
+
document: {...document, meta: JSON.stringify(document.meta)},
|
35
30
|
} as MarketContract.Actions.ReceiveOnRequest.IReceiveOnRequest,
|
36
31
|
});
|
37
32
|
|
@@ -45,5 +40,5 @@ async function recieve(
|
|
45
40
|
}
|
46
41
|
|
47
42
|
export const api = {
|
48
|
-
|
43
|
+
recieveOnRequest,
|
49
44
|
};
|
@@ -1,42 +1,33 @@
|
|
1
|
+
import { TransactResult } from '@wharfkit/session';
|
1
2
|
import { ISupplyOnRequest } from '../model';
|
2
3
|
import { transact } from 'src/shared/api';
|
3
4
|
import { ContractsList } from 'src/shared/config';
|
4
5
|
import { useRequestStore } from 'src/entities/Request/model/stores';
|
5
6
|
import { IUpdateOneRequest } from 'src/entities/Request';
|
6
7
|
import { MarketContract } from 'cooptypes';
|
7
|
-
import {
|
8
|
-
import { TransactResult } from '@wharfkit/session';
|
8
|
+
import { fakeDocument } from 'src/shared/lib/document/model/const';
|
9
9
|
|
10
10
|
async function supplyOnRequest(
|
11
11
|
params: ISupplyOnRequest
|
12
12
|
): Promise<TransactResult | undefined> {
|
13
|
-
//TODO получить подписанный
|
14
|
-
const document =
|
15
|
-
hash: '33CBC662E606F23F332B442BAB84F2D05BD498B66EF61BC918740606B05BD565',
|
16
|
-
public_key: 'PUB_K1_8YWRWjCdUQubPoHzT5ndvfhGKDf1ZL7v7Ge9iHoLtNp7wnVfG1',
|
17
|
-
signature: 'SIG_K1_KWeGQ48n78ybpkuVDf1M7nuGnT8pkPXFbYYMUXtFTFv2dEReMEmwW89r19dKmAVSFZwHTdxdqkB3ZQJeAS9CcQwb92E398',
|
18
|
-
meta: '',
|
19
|
-
} as IDocument;
|
13
|
+
//TODO здесь нужно получить подписанный документ (накладная) и подставить
|
14
|
+
const document = fakeDocument;
|
20
15
|
|
21
16
|
const result = await transact({
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
document,
|
37
|
-
} as MarketContract.Actions.SupplyOnRequest.ISupplyOnRequest,
|
38
|
-
},
|
39
|
-
],
|
17
|
+
account: ContractsList.Marketplace,
|
18
|
+
name: MarketContract.Actions.SupplyOnRequest.actionName,
|
19
|
+
authorization: [
|
20
|
+
{
|
21
|
+
actor: params.username,
|
22
|
+
permission: 'active',
|
23
|
+
},
|
24
|
+
],
|
25
|
+
data: {
|
26
|
+
username: params.username,
|
27
|
+
coopname: params.coopname,
|
28
|
+
exchange_id: params.request_id,
|
29
|
+
document: {...document, meta: JSON.stringify(document.meta)},
|
30
|
+
} as MarketContract.Actions.SupplyOnRequest.ISupplyOnRequest,
|
40
31
|
});
|
41
32
|
|
42
33
|
const requestsStore = useRequestStore();
|
@@ -28,7 +28,7 @@ import { notEmpty, isDomain } from 'src/shared/lib/utils';
|
|
28
28
|
import { useSessionStore } from 'src/entities/Session';
|
29
29
|
import { RegistratorContract } from 'cooptypes';
|
30
30
|
import { FailAlert, SuccessAlert } from 'src/shared/api';
|
31
|
-
import type {
|
31
|
+
import type { IDocument } from 'src/shared/lib/types/document';
|
32
32
|
import { env } from 'src/shared/config';
|
33
33
|
|
34
34
|
const emit = defineEmits(['finish'])
|
@@ -39,7 +39,7 @@ const isSubmitting = ref(false)
|
|
39
39
|
|
40
40
|
const props = defineProps({
|
41
41
|
document: {
|
42
|
-
type: Object as () =>
|
42
|
+
type: Object as () => IDocument,
|
43
43
|
required: true,
|
44
44
|
}
|
45
45
|
})
|
@@ -62,10 +62,12 @@ const data = ref<RegistratorContract.Actions.RegisterCooperative.IRegisterCooper
|
|
62
62
|
},
|
63
63
|
username: session.username,
|
64
64
|
document: {
|
65
|
+
version: '1.0.0',
|
65
66
|
hash: '',
|
66
|
-
|
67
|
-
|
68
|
-
meta: ''
|
67
|
+
doc_hash: '',
|
68
|
+
meta_hash: '',
|
69
|
+
meta: '',
|
70
|
+
signatures: []
|
69
71
|
}
|
70
72
|
})
|
71
73
|
|
@@ -1,21 +1,39 @@
|
|
1
1
|
import { PrivateKey } from '@wharfkit/antelope';
|
2
2
|
import {
|
3
|
-
|
4
|
-
IKeyPair,
|
5
|
-
ISendStatement,
|
3
|
+
IKeyPair
|
6
4
|
} from 'src/shared/lib/types/user';
|
7
5
|
import { sendPOST } from 'src/shared/api';
|
8
|
-
import { ICreateUser } from '../model';
|
9
6
|
import type { ICreatedPayment } from '@coopenomics/controller';
|
7
|
+
import { Mutations } from '@coopenomics/sdk';
|
8
|
+
import { client } from 'src/shared/api/client';
|
9
|
+
import type { IRegisterAccount, IRegisteredAccountResult } from 'src/shared/lib/types/user/IUserData';
|
10
|
+
import type { ISendStatement, ISendStatementResult } from '../model';
|
10
11
|
|
11
|
-
async function createUser(data:
|
12
|
-
const
|
13
|
-
|
14
|
-
|
12
|
+
async function createUser(data: IRegisterAccount): Promise<IRegisteredAccountResult> {
|
13
|
+
const { [Mutations.Accounts.RegisterAccount.name]: result } = await client.Mutation(
|
14
|
+
Mutations.Accounts.RegisterAccount.mutation,
|
15
|
+
{
|
16
|
+
variables: {
|
17
|
+
data
|
18
|
+
}
|
19
|
+
}
|
20
|
+
);
|
21
|
+
console.log('result: ', result, data);
|
22
|
+
return result;
|
15
23
|
}
|
16
24
|
|
17
|
-
async function sendStatement(data: ISendStatement): Promise<
|
18
|
-
|
25
|
+
async function sendStatement(data: ISendStatement): Promise<ISendStatementResult> {
|
26
|
+
console.log('send statement: ', data);
|
27
|
+
const { [Mutations.Participants.RegisterParticipant.name]: result } = await client.Mutation(
|
28
|
+
Mutations.Participants.RegisterParticipant.mutation,
|
29
|
+
{
|
30
|
+
variables: {
|
31
|
+
data
|
32
|
+
}
|
33
|
+
}
|
34
|
+
);
|
35
|
+
|
36
|
+
return result;
|
19
37
|
}
|
20
38
|
|
21
39
|
async function emailIsExist(email: string): Promise<boolean> {
|
@@ -2,13 +2,12 @@ import { api } from '../api';
|
|
2
2
|
import emailRegex from 'email-regex';
|
3
3
|
const emailValidator = emailRegex({ exact: true });
|
4
4
|
|
5
|
-
import { IGeneratedAccount
|
5
|
+
import { IGeneratedAccount } from 'src/shared/lib/types/user';
|
6
6
|
|
7
7
|
import { useSessionStore } from 'src/entities/Session';
|
8
8
|
import { useGlobalStore } from 'src/shared/store';
|
9
9
|
import { useSystemStore } from 'src/entities/System/model';
|
10
10
|
|
11
|
-
import { IObjectedDocument } from 'src/shared/lib/types/document';
|
12
11
|
import {
|
13
12
|
ICreatedPayment,
|
14
13
|
} from 'src/shared/lib/types/payments';
|
@@ -16,10 +15,11 @@ import {
|
|
16
15
|
useCurrentUserStore,
|
17
16
|
} from 'src/entities/User';
|
18
17
|
import { useRegistratorStore } from 'src/entities/Registrator'
|
19
|
-
import { IEntrepreneurData, IIndividualData, IOrganizationData, IUserData } from 'src/shared/lib/types/user/IUserData';
|
18
|
+
import { IEntrepreneurData, IIndividualData, IOrganizationData, IUserData, type IRegisterAccount } from 'src/shared/lib/types/user/IUserData';
|
20
19
|
import { client } from 'src/shared/api/client';
|
21
|
-
import { Mutations } from '@coopenomics/sdk';
|
22
|
-
|
20
|
+
import { Mutations, Zeus } from '@coopenomics/sdk';
|
21
|
+
import { DigitalDocument } from 'src/shared/lib/document';
|
22
|
+
import { IDocument } from 'src/shared/lib/types/document';
|
23
23
|
export interface ICreateUser {
|
24
24
|
email: string;
|
25
25
|
entrepreneur_data?: IEntrepreneurData;
|
@@ -32,6 +32,11 @@ export interface ICreateUser {
|
|
32
32
|
username: string;
|
33
33
|
}
|
34
34
|
|
35
|
+
|
36
|
+
export type ISendStatement = Mutations.Participants.RegisterParticipant.IInput['data'];
|
37
|
+
export type ISendStatementResult = Mutations.Participants.RegisterParticipant.IOutput[typeof Mutations.Participants.RegisterParticipant.name];
|
38
|
+
|
39
|
+
|
35
40
|
export function useCreateUser() {
|
36
41
|
const store = useRegistratorStore().state
|
37
42
|
const { info } = useSystemStore()
|
@@ -46,6 +51,7 @@ export function useCreateUser() {
|
|
46
51
|
async function sendStatementAndAgreements(): Promise<void> {
|
47
52
|
const data: ISendStatement = {
|
48
53
|
username: store.account.username,
|
54
|
+
braname: store.selectedBranch,
|
49
55
|
statement: store.statement,
|
50
56
|
wallet_agreement: store.walletAgreement,
|
51
57
|
privacy_agreement: store.privacyAgreement,
|
@@ -57,7 +63,7 @@ export function useCreateUser() {
|
|
57
63
|
}
|
58
64
|
|
59
65
|
|
60
|
-
async function signStatement(): Promise<
|
66
|
+
async function signStatement(): Promise<IDocument> {
|
61
67
|
const variables: Mutations.Participants.GenerateParticipantApplication.IInput = {
|
62
68
|
data: {
|
63
69
|
signature: store.signature,
|
@@ -65,7 +71,7 @@ export function useCreateUser() {
|
|
65
71
|
coopname: info.coopname,
|
66
72
|
username: store.account.username,
|
67
73
|
braname: store.selectedBranch,
|
68
|
-
links: [store.walletAgreement.
|
74
|
+
links: [store.walletAgreement.doc_hash, store.privacyAgreement.doc_hash, store.signatureAgreement.doc_hash, store.userAgreement.doc_hash]
|
69
75
|
}
|
70
76
|
}
|
71
77
|
|
@@ -74,12 +80,13 @@ export function useCreateUser() {
|
|
74
80
|
{ variables }
|
75
81
|
);
|
76
82
|
|
77
|
-
|
83
|
+
const digitalDocument = new DigitalDocument(result);
|
84
|
+
store.statement = await digitalDocument.sign(store.account.username);
|
78
85
|
|
79
86
|
return store.statement;
|
80
87
|
}
|
81
88
|
|
82
|
-
async function signPrivacyAgreement(): Promise<
|
89
|
+
async function signPrivacyAgreement(): Promise<IDocument> {
|
83
90
|
const variables: Mutations.Agreements.GeneratePrivacyAgreement.IInput = {
|
84
91
|
data: {
|
85
92
|
coopname: info.coopname,
|
@@ -92,12 +99,13 @@ export function useCreateUser() {
|
|
92
99
|
{ variables }
|
93
100
|
);
|
94
101
|
|
95
|
-
|
102
|
+
const digitalDocument = new DigitalDocument(result);
|
103
|
+
store.privacyAgreement = await digitalDocument.sign(store.account.username);
|
96
104
|
|
97
105
|
return store.privacyAgreement;
|
98
106
|
}
|
99
107
|
|
100
|
-
async function signSignatureAgreement(): Promise<
|
108
|
+
async function signSignatureAgreement(): Promise<IDocument> {
|
101
109
|
const variables: Mutations.Agreements.GenerateSignatureAgreement.IInput = {
|
102
110
|
data: {
|
103
111
|
coopname: info.coopname,
|
@@ -110,14 +118,14 @@ export function useCreateUser() {
|
|
110
118
|
{ variables }
|
111
119
|
);
|
112
120
|
|
113
|
-
|
121
|
+
const digitalDocument = new DigitalDocument(result);
|
122
|
+
store.signatureAgreement = await digitalDocument.sign(store.account.username);
|
114
123
|
|
115
124
|
return store.signatureAgreement;
|
116
|
-
|
117
125
|
}
|
118
126
|
|
119
127
|
|
120
|
-
async function signUserAgreement(): Promise<
|
128
|
+
async function signUserAgreement(): Promise<IDocument> {
|
121
129
|
const variables: Mutations.Agreements.GenerateUserAgreement.IInput = {
|
122
130
|
data: {
|
123
131
|
coopname: info.coopname,
|
@@ -130,16 +138,16 @@ export function useCreateUser() {
|
|
130
138
|
{ variables }
|
131
139
|
);
|
132
140
|
|
133
|
-
|
141
|
+
const digitalDocument = new DigitalDocument(result);
|
142
|
+
store.userAgreement = await digitalDocument.sign(store.account.username);
|
134
143
|
|
135
144
|
return store.userAgreement;
|
136
|
-
|
137
145
|
}
|
138
146
|
|
139
147
|
|
140
148
|
|
141
149
|
|
142
|
-
async function signWalletAgreement(): Promise<
|
150
|
+
async function signWalletAgreement(): Promise<IDocument> {
|
143
151
|
const variables: Mutations.Agreements.GenerateWalletAgreement.IInput = {
|
144
152
|
data: {
|
145
153
|
coopname: info.coopname,
|
@@ -152,7 +160,8 @@ export function useCreateUser() {
|
|
152
160
|
{ variables }
|
153
161
|
);
|
154
162
|
|
155
|
-
|
163
|
+
const digitalDocument = new DigitalDocument(result);
|
164
|
+
store.walletAgreement = await digitalDocument.sign(store.account.username);
|
156
165
|
|
157
166
|
return store.walletAgreement;
|
158
167
|
}
|
@@ -175,44 +184,43 @@ export function useCreateUser() {
|
|
175
184
|
);
|
176
185
|
|
177
186
|
return result;
|
178
|
-
|
179
187
|
}
|
180
188
|
|
181
189
|
async function createUser(
|
182
190
|
email: string,
|
183
191
|
userData: IUserData,
|
184
|
-
|
192
|
+
generatedAccount: IGeneratedAccount
|
185
193
|
): Promise<void> {
|
186
194
|
|
187
195
|
const synthData = { type: userData.type } as any;
|
188
196
|
|
189
|
-
if (synthData.type ===
|
197
|
+
if (synthData.type === Zeus.AccountType.individual) {
|
190
198
|
synthData.individual_data = userData.individual_data;
|
191
|
-
} else if (synthData.type ===
|
199
|
+
} else if (synthData.type === Zeus.AccountType.organization) {
|
192
200
|
synthData.organization_data = userData.organization_data;
|
193
|
-
} else if (synthData.type ===
|
201
|
+
} else if (synthData.type === Zeus.AccountType.entrepreneur) {
|
194
202
|
synthData.entrepreneur_data = userData.entrepreneur_data;
|
195
203
|
}
|
196
|
-
|
204
|
+
console.log('synthData: ', synthData);
|
205
|
+
const data: IRegisterAccount = {
|
197
206
|
...synthData,
|
198
|
-
role: 'user',
|
199
207
|
email,
|
200
|
-
username:
|
201
|
-
public_key:
|
208
|
+
username: generatedAccount.username,
|
209
|
+
public_key: generatedAccount.public_key,
|
202
210
|
};
|
203
|
-
|
204
|
-
const {
|
211
|
+
console.log('data: ', data);
|
212
|
+
const { account, tokens } = await api.createUser(data);
|
205
213
|
|
206
214
|
const globalStore = useGlobalStore();
|
207
215
|
const sessionStore = useSessionStore();
|
208
216
|
|
209
217
|
await globalStore.setTokens(tokens);
|
210
|
-
await globalStore.setWif(
|
218
|
+
await globalStore.setWif(account.username, generatedAccount.private_key);
|
211
219
|
|
212
220
|
await sessionStore.init();
|
213
221
|
|
214
222
|
const currentUser = useCurrentUserStore();
|
215
|
-
await currentUser.loadProfile(
|
223
|
+
await currentUser.loadProfile(account.username, info.coopname);
|
216
224
|
}
|
217
225
|
|
218
226
|
function emailIsValid(email: string): boolean {
|
@@ -69,18 +69,18 @@ const onAuthorizeDecision = async (row) => {
|
|
69
69
|
}
|
70
70
|
}
|
71
71
|
|
72
|
-
const onVoteFor = async (
|
73
|
-
processingDecisions.value[
|
72
|
+
const onVoteFor = async (row) => {
|
73
|
+
processingDecisions.value[row.table.id] = true
|
74
74
|
|
75
75
|
try {
|
76
|
-
await voteForDecision(
|
76
|
+
await voteForDecision(row)
|
77
77
|
SuccessAlert('Голос принят')
|
78
78
|
await loadDecisions(route.params.coopname as string)
|
79
79
|
} catch (e) {
|
80
80
|
FailAlert(e)
|
81
81
|
} finally {
|
82
82
|
// Гарантированно сбрасываем состояние загрузки
|
83
|
-
processingDecisions.value[
|
83
|
+
processingDecisions.value[row.table.id] = false
|
84
84
|
|
85
85
|
// Добавляем таймаут для гарантии обновления UI
|
86
86
|
setTimeout(() => {
|
@@ -89,18 +89,18 @@ const onVoteFor = async (decision_id) => {
|
|
89
89
|
}
|
90
90
|
}
|
91
91
|
|
92
|
-
const onVoteAgainst = async (
|
93
|
-
processingDecisions.value[
|
92
|
+
const onVoteAgainst = async (row) => {
|
93
|
+
processingDecisions.value[row.table.id] = true
|
94
94
|
|
95
95
|
try {
|
96
|
-
await voteAgainstDecision(
|
96
|
+
await voteAgainstDecision(row)
|
97
97
|
SuccessAlert('Голос принят')
|
98
98
|
await loadDecisions(route.params.coopname as string)
|
99
99
|
} catch (e) {
|
100
100
|
FailAlert(e)
|
101
101
|
} finally {
|
102
102
|
// Гарантированно сбрасываем состояние загрузки
|
103
|
-
processingDecisions.value[
|
103
|
+
processingDecisions.value[row.table.id] = false
|
104
104
|
|
105
105
|
// Добавляем таймаут для гарантии обновления UI
|
106
106
|
setTimeout(() => {
|
@@ -48,16 +48,16 @@ loadParticipants()
|
|
48
48
|
|
49
49
|
const update = (account: IAccount, newData: IIndividualData | IOrganizationData | IEntrepreneurData) => {
|
50
50
|
switch (account.private_account?.type) {
|
51
|
-
case AccountTypes.
|
51
|
+
case AccountTypes.individual:
|
52
52
|
account.private_account.individual_data = {
|
53
53
|
...newData as IIndividualData,
|
54
54
|
passport: (newData as IIndividualData).passport ?? undefined
|
55
55
|
}
|
56
56
|
break
|
57
|
-
case AccountTypes.
|
57
|
+
case AccountTypes.entrepreneur:
|
58
58
|
account.private_account.entrepreneur_data = newData as IEntrepreneurData
|
59
59
|
break
|
60
|
-
case AccountTypes.
|
60
|
+
case AccountTypes.organization:
|
61
61
|
account.private_account.organization_data = newData as IOrganizationData
|
62
62
|
break
|
63
63
|
}
|
@@ -62,13 +62,6 @@ watch(email, checkEmailExists)
|
|
62
62
|
const setEmail = () => {
|
63
63
|
if (isValidEmail.value && !isEmailExist.value) {
|
64
64
|
store.state.email = email.value
|
65
|
-
if (store.state.userData.individual_data)
|
66
|
-
store.state.userData.individual_data.email = email.value
|
67
|
-
if (store.state.userData.organization_data)
|
68
|
-
store.state.userData.organization_data.email = email.value
|
69
|
-
if (store.state.userData.entrepreneur_data)
|
70
|
-
store.state.userData.entrepreneur_data.email = email.value
|
71
|
-
|
72
65
|
store.next();
|
73
66
|
}
|
74
67
|
}
|