hl-core 0.0.7 → 0.0.8

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.
Files changed (62) hide show
  1. package/.prettierrc +2 -1
  2. package/api/index.ts +580 -0
  3. package/api/interceptors.ts +38 -0
  4. package/components/Button/Btn.vue +57 -0
  5. package/components/Button/BtnIcon.vue +47 -0
  6. package/components/Button/ScrollButtons.vue +6 -0
  7. package/components/Button/SortArrow.vue +21 -0
  8. package/components/Complex/Content.vue +5 -0
  9. package/components/Complex/ContentBlock.vue +5 -0
  10. package/components/Complex/Page.vue +43 -0
  11. package/components/Dialog/Dialog.vue +76 -0
  12. package/components/Dialog/FamilyDialog.vue +39 -0
  13. package/components/Form/FormBlock.vue +114 -0
  14. package/components/Form/FormSection.vue +18 -0
  15. package/components/Form/FormTextSection.vue +20 -0
  16. package/components/Form/FormToggle.vue +52 -0
  17. package/components/Form/ProductConditionsBlock.vue +68 -0
  18. package/components/Input/EmptyFormField.vue +5 -0
  19. package/components/Input/FileInput.vue +71 -0
  20. package/components/Input/FormInput.vue +171 -0
  21. package/components/Input/PanelInput.vue +133 -0
  22. package/components/Input/RoundedInput.vue +143 -0
  23. package/components/Layout/Drawer.vue +44 -0
  24. package/components/Layout/Header.vue +48 -0
  25. package/components/Layout/Loader.vue +35 -0
  26. package/components/Layout/SettingsPanel.vue +48 -0
  27. package/components/List/ListEmpty.vue +22 -0
  28. package/components/Menu/MenuNav.vue +108 -0
  29. package/components/Menu/MenuNavItem.vue +37 -0
  30. package/components/Pages/Anketa.vue +333 -0
  31. package/components/Pages/Auth.vue +91 -0
  32. package/components/Pages/Documents.vue +108 -0
  33. package/components/Pages/MemberForm.vue +1138 -0
  34. package/components/Pages/ProductAgreement.vue +18 -0
  35. package/components/Pages/ProductConditions.vue +349 -0
  36. package/components/Panel/PanelItem.vue +5 -0
  37. package/components/Panel/PanelSelectItem.vue +20 -0
  38. package/components/Transitions/FadeTransition.vue +5 -0
  39. package/composables/axios.ts +11 -0
  40. package/composables/classes.ts +1129 -0
  41. package/composables/constants.ts +65 -0
  42. package/composables/index.ts +168 -2
  43. package/composables/styles.ts +41 -8
  44. package/layouts/clear.vue +3 -0
  45. package/layouts/default.vue +75 -0
  46. package/layouts/full.vue +6 -0
  47. package/nuxt.config.ts +27 -5
  48. package/package.json +23 -11
  49. package/pages/500.vue +85 -0
  50. package/plugins/helperFunctionsPlugins.ts +14 -2
  51. package/plugins/storePlugin.ts +6 -7
  52. package/plugins/vuetifyPlugin.ts +10 -0
  53. package/store/data.store.js +2460 -6
  54. package/store/form.store.ts +8 -0
  55. package/store/member.store.ts +291 -0
  56. package/store/messages.ts +156 -37
  57. package/store/rules.js +26 -28
  58. package/tailwind.config.js +10 -0
  59. package/types/index.ts +250 -0
  60. package/app.vue +0 -3
  61. package/components/Button/GreenBtn.vue +0 -33
  62. package/store/app.store.js +0 -12
package/.prettierrc CHANGED
@@ -5,5 +5,6 @@
5
5
  "trailingComma": "all",
6
6
  "bracketSpacing": true,
7
7
  "arrowParens": "avoid",
8
- "endOfLine": "auto"
8
+ "endOfLine": "auto",
9
+ "printWidth": 180
9
10
  }
package/api/index.ts ADDED
@@ -0,0 +1,580 @@
1
+ import { useAxios } from '@/composables/axios';
2
+ import { Value, IDocument } from '@/composables/classes';
3
+ import { AxiosRequestConfig } from 'axios';
4
+
5
+ enum Methods {
6
+ GET = 'GET',
7
+ POST = 'POST',
8
+ }
9
+
10
+ export class ApiClass {
11
+ private readonly baseURL: string = import.meta.env.VITE_BASE_URL as string;
12
+ private readonly productUrl: string = import.meta.env.VITE_PRODUCT_URL as string;
13
+
14
+ private async axiosCall(config: AxiosRequestConfig) {
15
+ const dataStore = useDataStore();
16
+ if ((dataStore.isEFO && this.baseURL) || (!dataStore.isEFO && this.baseURL && this.productUrl)) {
17
+ const { data } = await useAxios(this.baseURL as string).request(config);
18
+ return data;
19
+ } else {
20
+ console.error('No Axios baseURL or productURL');
21
+ return null;
22
+ }
23
+ }
24
+
25
+ async loginUser(data: { login: string; password: string; numAttempt: number }): Promise<{ refreshToken: string; accessToken: string }> {
26
+ return this.axiosCall({
27
+ method: Methods.POST,
28
+ url: '/identity/api/Account/login',
29
+ data: data,
30
+ });
31
+ }
32
+
33
+ async getNewAccessToken({ refreshToken, accessToken }: { refreshToken: string; accessToken: string }): Promise<{ refreshToken: string; accessToken: string }> {
34
+ return this.axiosCall({
35
+ method: Methods.POST,
36
+ url: '/identity/api/Account/refresh',
37
+ headers: {
38
+ 'X-Refresh-Token': refreshToken,
39
+ 'X-Access-Token': accessToken,
40
+ },
41
+ });
42
+ }
43
+
44
+ // Страна
45
+ async getCountries() {
46
+ return this.axiosCall({
47
+ method: Methods.GET,
48
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/Country',
49
+ });
50
+ }
51
+
52
+ // Страна гражданства
53
+ async getCitizenshipCountries() {
54
+ return this.axiosCall({
55
+ method: Methods.GET,
56
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/Questionary?filter=500012',
57
+ });
58
+ }
59
+
60
+ // Страна налогового резидетства
61
+ async getTaxCountries() {
62
+ return this.axiosCall({
63
+ method: Methods.GET,
64
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/Questionary?filter=500014',
65
+ });
66
+ }
67
+
68
+ async getAdditionalTaxCountries() {
69
+ return this.axiosCall({
70
+ method: Methods.GET,
71
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/Questionary?filter=507777',
72
+ });
73
+ }
74
+
75
+ // Область
76
+ async getStates() {
77
+ return this.axiosCall({
78
+ method: Methods.GET,
79
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/State',
80
+ });
81
+ }
82
+
83
+ // Регион
84
+ async getRegions() {
85
+ return this.axiosCall({
86
+ method: Methods.GET,
87
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/Region',
88
+ });
89
+ }
90
+
91
+ // Город
92
+ async getCities() {
93
+ return this.axiosCall({
94
+ method: Methods.GET,
95
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/CityVillage',
96
+ });
97
+ }
98
+
99
+ // Вид населенного пункта
100
+ async getLocalityTypes() {
101
+ return this.axiosCall({
102
+ method: Methods.GET,
103
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/LocalityType',
104
+ });
105
+ }
106
+
107
+ // Тип документа
108
+ async getDocumentTypes() {
109
+ return this.axiosCall({
110
+ method: Methods.GET,
111
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/DocumentTypePhys',
112
+ });
113
+ }
114
+
115
+ // Кем выдано
116
+ async getDocumentIssuers() {
117
+ return this.axiosCall({
118
+ method: Methods.GET,
119
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/DocIssuer',
120
+ });
121
+ }
122
+
123
+ // Признак резидентства
124
+ async getResidents() {
125
+ return this.axiosCall({
126
+ method: Methods.GET,
127
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/Questionary?filter=500011',
128
+ });
129
+ }
130
+
131
+ // Код сектора экономики
132
+ async getSectorCode() {
133
+ return this.axiosCall({
134
+ method: Methods.GET,
135
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/Questionary?filter=500003',
136
+ });
137
+ }
138
+
139
+ // Семейное положение
140
+ async getFamilyStatuses() {
141
+ return this.axiosCall({
142
+ method: Methods.GET,
143
+ url: '/Arm/api/Dictionary/GetDictionaryItems/DicFamilyStatus',
144
+ });
145
+ }
146
+
147
+ // Степень родства
148
+ async getRelationTypes() {
149
+ return this.axiosCall({
150
+ method: Methods.GET,
151
+ url: '/Ekk/api/Contragentinsis/DictionaryItems/Relation',
152
+ });
153
+ }
154
+
155
+ async getContragent(queryData: any) {
156
+ return this.axiosCall({
157
+ method: Methods.GET,
158
+ url: `/Ekk/api/Contragentinsis/Contragent?Iin=${queryData.iin}&FirstName=${queryData.firstName}&LastName=${queryData.lastName}&MiddleName${queryData.middleName}`,
159
+ });
160
+ }
161
+
162
+ async getQuestionList(surveyType: string, processInstanceId: string, insuredId: number | string): Promise<AnketaFirst> {
163
+ return this.axiosCall({
164
+ method: Methods.GET,
165
+ url: `/Baiterek/api/Application/Anketa/${surveyType}/${processInstanceId}/${insuredId}`,
166
+ });
167
+ }
168
+
169
+ async getQuestionListSecond(surveyType: string, processInstanceId: string, insuredId: number | string): Promise<AnketaSecond[]> {
170
+ return this.axiosCall({
171
+ method: Methods.GET,
172
+ url: `/Baiterek/api/Application/Anketa/${surveyType}/${processInstanceId}/${insuredId}`,
173
+ });
174
+ }
175
+
176
+ async definedAnswers(filter: string) {
177
+ return this.axiosCall({
178
+ method: Methods.GET,
179
+ url: `/ekk/api/Contragentinsis/DictionaryItems/Questionary?filter=${filter}`,
180
+ });
181
+ }
182
+
183
+ async setSurvey(surveyData: AnketaFirst) {
184
+ return this.axiosCall({
185
+ method: Methods.POST,
186
+ data: surveyData,
187
+ url: `/${this.productUrl}/api/Application/SetAnketa`,
188
+ });
189
+ }
190
+
191
+ async getQuestionRefs(id: string | number): Promise<Value[]> {
192
+ return this.axiosCall({
193
+ method: Methods.GET,
194
+ url: `/Ekk/api/Contragentinsis/DictionaryItems/Questionary?filter=${id}`,
195
+ });
196
+ }
197
+
198
+ async getProcessIndexRate(processCode: string | number) {
199
+ return this.axiosCall({
200
+ method: Methods.GET,
201
+ url: `/Arm/api/Dictionary/ProcessIndexRate/${processCode}`,
202
+ });
203
+ }
204
+
205
+ async getAdditionalInsuranceTermsAnswers(processCode: string | number, questionId: string) {
206
+ return this.axiosCall({
207
+ method: Methods.GET,
208
+ url: `/Arm/api/Dictionary/ProcessCoverTypeSum/${processCode}/${questionId}`,
209
+ });
210
+ }
211
+
212
+ async getProcessPaymentPeriod(processCode: string | number) {
213
+ return this.axiosCall({
214
+ method: Methods.GET,
215
+ url: `/Arm/api/Dictionary/ProcessPaymentPeriod/${processCode}`,
216
+ });
217
+ }
218
+
219
+ async getContragentById(id: any) {
220
+ return this.axiosCall({
221
+ method: Methods.GET,
222
+ url: `/Ekk/api/Contragentinsis/Contragent?PersonId=${id}`,
223
+ });
224
+ }
225
+
226
+ async saveContragent(data: any) {
227
+ return this.axiosCall({
228
+ method: Methods.POST,
229
+ url: `/Ekk/api/Contragentinsis/SaveContragent`,
230
+ data: data,
231
+ });
232
+ }
233
+
234
+ async getFile(id: string) {
235
+ return await this.axiosCall({
236
+ method: Methods.GET,
237
+ url: `/Arm/api/File/DownloadFile/${id}`,
238
+ responseType: 'arraybuffer',
239
+ headers: {
240
+ 'Content-Type': 'application/pdf',
241
+ },
242
+ });
243
+ }
244
+
245
+ async getDicFileTypeList() {
246
+ return this.axiosCall({
247
+ method: Methods.GET,
248
+ url: '/Arm/api/Dictionary/GetDictionaryItems/DicFileType',
249
+ });
250
+ }
251
+
252
+ async getContrAgentData(personId: string | number) {
253
+ return this.axiosCall({
254
+ method: Methods.GET,
255
+ url: `/Ekk/api/Contragentinsis/Questionaries?PersonId=${personId}`,
256
+ });
257
+ }
258
+
259
+ async getContrAgentContacts(personId: string | number) {
260
+ return this.axiosCall({
261
+ method: Methods.GET,
262
+ url: `/Ekk/api/Contragentinsis/Contacts?PersonId=${personId}`,
263
+ });
264
+ }
265
+
266
+ async getContrAgentDocuments(personId: string | number) {
267
+ return this.axiosCall({
268
+ method: Methods.GET,
269
+ url: `/Ekk/api/Contragentinsis/Documents?PersonId=${personId}`,
270
+ });
271
+ }
272
+
273
+ async getContrAgentAddress(personId: string | number) {
274
+ return this.axiosCall({
275
+ method: Methods.GET,
276
+ url: `/Ekk/api/Contragentinsis/Address?PersonId=${personId}`,
277
+ });
278
+ }
279
+
280
+ async getTaskList(data: any): Promise<{ items: TaskListItem[]; totalItems: number }> {
281
+ return this.axiosCall({
282
+ method: Methods.POST,
283
+ url: `/Arm/api/Bpm/TaskList`,
284
+ data: data,
285
+ });
286
+ }
287
+
288
+ async getProcessHistory(id: string): Promise<TaskHistory[]> {
289
+ return this.axiosCall({
290
+ url: `/Arm/api/Bpm/GetProcessHistory?processInstanceId=${id}`,
291
+ });
292
+ }
293
+
294
+ async sendSms(data: { phone: string; template: string; tempFlags: { url: string } }): Promise<void> {
295
+ return this.axiosCall({
296
+ baseURL: import.meta.env.VITE_SMS_SERVICE as string,
297
+ method: Methods.POST,
298
+ url: '/message',
299
+ data: data,
300
+ });
301
+ }
302
+
303
+ async getUserGroups(): Promise<Item[]> {
304
+ return this.axiosCall({
305
+ method: Methods.GET,
306
+ url: '/Arm/api/Bpm/TaskGroups',
307
+ });
308
+ }
309
+
310
+ async getDictionaryItems(dictName: string) {
311
+ return this.axiosCall({
312
+ method: Methods.GET,
313
+ url: `/ekk/api/ContragentInsis/DictionaryItems/${dictName}`,
314
+ });
315
+ }
316
+
317
+ async getOtpStatus(data: OtpDataType): Promise<boolean> {
318
+ return this.axiosCall({
319
+ method: Methods.POST,
320
+ url: '/Arm/api/Otp/OtpLifeStatus',
321
+ data: data,
322
+ });
323
+ }
324
+
325
+ async sendOtp(data: OtpDataType): Promise<SendOtpResponse> {
326
+ return this.axiosCall({
327
+ method: Methods.POST,
328
+ url: '/Arm/api/Otp/Get',
329
+ data: data,
330
+ });
331
+ }
332
+
333
+ async checkOtp(data: { tokenId: string; phoneNumber: string; code: string }): Promise<SendOtpResponse> {
334
+ return this.axiosCall({
335
+ method: Methods.POST,
336
+ url: '/Arm/api/Otp/Check',
337
+ data: data,
338
+ });
339
+ }
340
+
341
+ async getProcessList(): Promise<Item[]> {
342
+ return this.axiosCall({
343
+ method: Methods.GET,
344
+ url: '/Arm/api/Bpm/ProcessList',
345
+ timeout: 10000,
346
+ });
347
+ }
348
+
349
+ async startApplication(data: StartApplicationType): Promise<{
350
+ processInstanceId: string;
351
+ }> {
352
+ return this.axiosCall({
353
+ method: Methods.POST,
354
+ url: `/${this.productUrl}/api/Application/StartApplication`,
355
+ data: data,
356
+ });
357
+ }
358
+
359
+ async getApplicationData(id: string) {
360
+ return this.axiosCall({
361
+ url: `/${this.productUrl}/api/Application/applicationData?Id=${id} `,
362
+ });
363
+ }
364
+
365
+ async getCalculation(id: string) {
366
+ return this.axiosCall({
367
+ method: Methods.POST,
368
+ url: `/${this.productUrl}/api/Application/Calculator?processInstanceId=${id}`,
369
+ });
370
+ }
371
+
372
+ async setApplication(data: any) {
373
+ return this.axiosCall({
374
+ method: Methods.POST,
375
+ url: `/${this.productUrl}/api/Application/SetApplicationData`,
376
+ data,
377
+ responseType: 'blob',
378
+ });
379
+ }
380
+
381
+ async generatePdfDocument(data: any) {
382
+ return await this.axiosCall({
383
+ method: Methods.POST,
384
+ url: `/Arm/api/Bpm/GeneratePdfDocument`,
385
+ responseType: 'blob',
386
+ data: data,
387
+ });
388
+ }
389
+
390
+ async deleteFile(data: any) {
391
+ return this.axiosCall({
392
+ method: Methods.POST,
393
+ url: '/Arm/api/File/DeleteFiles',
394
+ data: data,
395
+ });
396
+ }
397
+
398
+ async uploadFiles(data: any) {
399
+ return this.axiosCall({
400
+ method: Methods.POST,
401
+ url: '/Arm/api/File/UploadFiles',
402
+ headers: {
403
+ 'Content-Type': 'multipart/form-data',
404
+ },
405
+ data: data,
406
+ });
407
+ }
408
+
409
+ async sendTask(data: any) {
410
+ return this.axiosCall({
411
+ method: Methods.POST,
412
+ url: `/${this.productUrl}/api/Application/SendTask`,
413
+ data: data,
414
+ });
415
+ }
416
+
417
+ async setMember(whichMember: string, data: any) {
418
+ return this.axiosCall({
419
+ method: Methods.POST,
420
+ url: `/Arm/api/BpmMembers/Set${whichMember}`,
421
+ data: data,
422
+ });
423
+ }
424
+
425
+ async deleteMember(whichMember: string, id: number | string) {
426
+ return this.axiosCall({
427
+ method: Methods.POST,
428
+ url: `/Arm/api/BpmMembers/Delete${whichMember}/${id}`,
429
+ });
430
+ }
431
+
432
+ async getInvoiceData(processInstanceId: string) {
433
+ return this.axiosCall({
434
+ method: Methods.GET,
435
+ url: `/Arm/api/Invoice/InvoiceData?processInstanceId=${processInstanceId}`,
436
+ });
437
+ }
438
+
439
+ async createInvoice(processInstanceId: string, amount: number | string) {
440
+ return this.axiosCall({
441
+ method: Methods.POST,
442
+ url: `/Arm/api/Invoice/CreateInvoice/${processInstanceId}/${amount}`,
443
+ });
444
+ }
445
+
446
+ async sendToEpay(processInstanceId: string) {
447
+ return this.axiosCall({
448
+ method: Methods.POST,
449
+ url: `/Arm/api/Invoice/SendToEpay/${processInstanceId}`,
450
+ });
451
+ }
452
+
453
+ async signToDocument(data: any) {
454
+ return this.axiosCall({
455
+ method: Methods.POST,
456
+ url: '/Arm/api/Bpm/SignDocument',
457
+ data: data,
458
+ });
459
+ }
460
+
461
+ async getSignedDocList(data: { processInstanceId: string }): Promise<IDocument[]> {
462
+ return this.axiosCall({
463
+ method: Methods.POST,
464
+ url: '/Arm/api/File/List',
465
+ data: data,
466
+ });
467
+ }
468
+
469
+ async calculateWithoutApplication(data: RecalculationDataType): Promise<RecalculationResponseType> {
470
+ return this.axiosCall({
471
+ method: Methods.POST,
472
+ url: `/${this.productUrl}/api/Application/Calculate`,
473
+ data: data,
474
+ });
475
+ }
476
+
477
+ async getDefaultCalculationData(): Promise<RecalculationDataType> {
478
+ return this.axiosCall({
479
+ method: Methods.GET,
480
+ url: `/${this.productUrl}/api/Application/DefaultCalculatorValues`,
481
+ });
482
+ }
483
+
484
+ async reCalculate(data: any) {
485
+ return this.axiosCall({
486
+ method: Methods.POST,
487
+ url: `/${this.productUrl}/api/Application/Recalculate`,
488
+ data: data,
489
+ });
490
+ }
491
+
492
+ async getValidateClientESBD(data: ESBDValidationType): Promise<ESBDResponseType> {
493
+ return this.axiosCall({
494
+ method: Methods.POST,
495
+ url: '/externalservices/api/ExternalServices/GetValidateClientEsbd',
496
+ data: data,
497
+ });
498
+ }
499
+
500
+ async isClaimTask(taskId: string): Promise<boolean> {
501
+ return this.axiosCall({
502
+ method: Methods.POST,
503
+ url: '/Arm/api/Bpm/IsClaimTask',
504
+ params: { TaskId: taskId },
505
+ });
506
+ }
507
+
508
+ async claimTask(taskId: string) {
509
+ return this.axiosCall({
510
+ method: Methods.POST,
511
+ url: '/Arm/api/Bpm/ClaimTaskUser',
512
+ params: { TaskId: taskId },
513
+ });
514
+ }
515
+
516
+ async getContragentFromGBDFL(data: { iin: string; phoneNumber: string }): Promise<GBDFLResponse> {
517
+ return this.axiosCall({
518
+ method: Methods.POST,
519
+ url: '/externalservices/api/ExternalServices/GetGbdflToken',
520
+ data: data,
521
+ });
522
+ }
523
+
524
+ async getFamilyInfo(data: { iin: string; phoneNumber: string }): Promise<FamilyInfoGKB> {
525
+ return this.axiosCall({
526
+ method: Methods.POST,
527
+ url: '/externalservices/api/ExternalServices/GetFamilyInfoToken',
528
+ data: data,
529
+ });
530
+ }
531
+
532
+ async getProcessTariff(code: number | string = 5) {
533
+ return this.axiosCall({ url: `/arm/api/Dictionary/ProcessTariff/${code}` });
534
+ }
535
+
536
+ async setConfirmation(data: any) {
537
+ return this.axiosCall({
538
+ method: Methods.POST,
539
+ url: '/Arm/api/UnderwritingCouncil/SetConfirmation',
540
+ data: data,
541
+ });
542
+ }
543
+
544
+ async getUnderwritingCouncilData(id: string | number) {
545
+ return this.axiosCall({
546
+ method: Methods.GET,
547
+ url: `/Arm/api/UnderwritingCouncil/ApplicationData?Id=${id}`,
548
+ });
549
+ }
550
+
551
+ async sendUnderwritingCouncilTask(data: any) {
552
+ return this.axiosCall({
553
+ method: Methods.POST,
554
+ url: '/arm/api/UnderwritingCouncil/SendTask',
555
+ data: data,
556
+ });
557
+ }
558
+
559
+ async filterManagerByRegion(dictName: string, filterName: string) {
560
+ return this.axiosCall({
561
+ method: Methods.GET,
562
+ url: `/ekk/api/ContragentInsis/DictionaryItems/${dictName}?filter=${filterName}`,
563
+ });
564
+ }
565
+
566
+ async setINSISWorkData(data: any) {
567
+ return this.axiosCall({
568
+ method: Methods.POST,
569
+ url: `/arm/api/Bpm/SetInsisWorkData`,
570
+ data: data,
571
+ });
572
+ }
573
+
574
+ async searchAgentByName(name: string) {
575
+ return this.axiosCall({
576
+ method: Methods.GET,
577
+ url: `/ekk/api/ContragentInsis/AgentByName?fullName=${name}`,
578
+ });
579
+ }
580
+ }
@@ -0,0 +1,38 @@
1
+ import { AxiosInstance } from 'axios';
2
+
3
+ export default function (axios: AxiosInstance) {
4
+ axios.interceptors.request.use(
5
+ request => {
6
+ const dataStore = useDataStore();
7
+ request.headers.Authorization = `Bearer ${dataStore.accessToken}`;
8
+ return request;
9
+ },
10
+ error => {
11
+ return Promise.reject(error);
12
+ },
13
+ );
14
+ axios.interceptors.response.use(
15
+ response => {
16
+ return response;
17
+ },
18
+ error => {
19
+ const dataStore = useDataStore();
20
+ const router = useRouter();
21
+ if (error.response.status === 401) {
22
+ dataStore.$reset();
23
+ localStorage.clear();
24
+ if (dataStore.isEFO) {
25
+ router.push({ name: 'Auth', query: { error: 401 } });
26
+ } else {
27
+ dataStore.sendToParent(constants.postActions.Error401, 401);
28
+ }
29
+ }
30
+ if (error.response.status >= 500) {
31
+ if (router.currentRoute.value.name !== 'Auth') {
32
+ dataStore.showToaster('error', error.stack, 5000);
33
+ }
34
+ }
35
+ return Promise.reject(error);
36
+ },
37
+ );
38
+ }
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <button
3
+ type="button"
4
+ class="transition-all"
5
+ @click="$emit('clicked')"
6
+ :disabled="disabled || loading"
7
+ :class="[
8
+ disabled ? 'disabled' : '',
9
+ classes,
10
+ btn,
11
+ $libStyles[`btnH${$capitalize(size)}` as keyof typeof $libStyles],
12
+ ]"
13
+ >
14
+ <base-loader v-if="loading" :size="24" color="#FFF" bg-color="" :width="2"></base-loader>
15
+ <span v-if="!loading">{{ text }}</span>
16
+ </button>
17
+ </template>
18
+
19
+ <script lang="ts">
20
+ export default defineComponent({
21
+ name: 'BaseBtn',
22
+ props: {
23
+ text: {
24
+ type: String,
25
+ default: 'Кнопка',
26
+ },
27
+ size: {
28
+ type: String,
29
+ default: 'md',
30
+ },
31
+ classes: {
32
+ type: String,
33
+ default: '',
34
+ },
35
+ disabled: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+ loading: {
40
+ type: Boolean,
41
+ default: false,
42
+ },
43
+ btn: {
44
+ type: String,
45
+ default: new Styles().blueBtn,
46
+ },
47
+ },
48
+
49
+ setup(props) {},
50
+ });
51
+ </script>
52
+
53
+ <style scoped>
54
+ .disabled {
55
+ opacity: 0.3;
56
+ }
57
+ </style>