simpleloan_api 1.0.8 → 1.1.2
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/dist/index.d.mts +77 -9
- package/dist/index.d.ts +77 -9
- package/dist/index.js +21 -7
- package/dist/index.mjs +16 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
|
|
3
|
-
type Mode =
|
|
4
|
-
declare const mode: vue.Ref<Mode>;
|
|
3
|
+
type Mode = 'development' | 'production';
|
|
5
4
|
declare function setMode(newMode: Mode): void;
|
|
6
5
|
declare function getMode(): Mode;
|
|
7
6
|
declare function setToken(newToken: string): void;
|
|
@@ -28,19 +27,88 @@ type PostParams<Body> = {
|
|
|
28
27
|
body: Body;
|
|
29
28
|
search?: SearchParams;
|
|
30
29
|
};
|
|
30
|
+
type PostParamsWithoutBody = {
|
|
31
|
+
search?: SearchParams;
|
|
32
|
+
};
|
|
31
33
|
|
|
32
|
-
type
|
|
34
|
+
type User = {
|
|
33
35
|
id: number;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
first_name: string;
|
|
37
|
+
last_name: string;
|
|
38
|
+
is_active: true;
|
|
39
|
+
deleted_at: string | null;
|
|
40
|
+
email: string;
|
|
41
|
+
middle_name: string;
|
|
42
|
+
dateofbirth: string;
|
|
43
|
+
phone: number;
|
|
44
|
+
phone_confirmed: boolean;
|
|
45
|
+
status: string;
|
|
46
|
+
passport_serial: number;
|
|
47
|
+
passport_number: number;
|
|
48
|
+
passport_date: Date;
|
|
49
|
+
passport_issuing: string | number;
|
|
50
|
+
passport_division_code: string | number;
|
|
51
|
+
address_country: string | number;
|
|
52
|
+
address_postcode: string | number;
|
|
53
|
+
address_region: string | number;
|
|
54
|
+
address_city: string | number;
|
|
55
|
+
address_street: string | number;
|
|
56
|
+
address_house: string | number;
|
|
57
|
+
address_flat: string | number;
|
|
58
|
+
ILBS_login: string | number;
|
|
59
|
+
cert_serial: string | number;
|
|
60
|
+
groups_ids: [];
|
|
61
|
+
permissions: string[];
|
|
62
|
+
title: string;
|
|
63
|
+
raw_permissions?: string[];
|
|
64
|
+
brokerclient_staff: number[];
|
|
65
|
+
salespoint_staff: number[];
|
|
66
|
+
is_filled_profile: boolean;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
type Login = {
|
|
70
|
+
email: string;
|
|
71
|
+
password: string;
|
|
72
|
+
code?: string;
|
|
73
|
+
};
|
|
74
|
+
type LoginResponse = {
|
|
75
|
+
user: User;
|
|
76
|
+
token: string;
|
|
77
|
+
token_expires: string;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/** Авторизация */
|
|
81
|
+
declare const useAccountLogin: () => {
|
|
82
|
+
response: vue.Ref<ApiResponse<LoginResponse> | null>;
|
|
83
|
+
pending: vue.Ref<boolean>;
|
|
84
|
+
post(params: PostParams<Login>): Promise<ApiResponse<LoginResponse> | null>;
|
|
85
|
+
};
|
|
86
|
+
/** Выход */
|
|
87
|
+
declare const useAccountLogout: () => {
|
|
88
|
+
response: vue.Ref<ApiResponse<unknown> | null>;
|
|
89
|
+
pending: vue.Ref<boolean>;
|
|
90
|
+
post(params: PostParams<unknown>): Promise<ApiResponse<unknown> | null>;
|
|
91
|
+
};
|
|
92
|
+
/** Проверка авторизации */
|
|
93
|
+
declare const useAccountCheckLogin: () => {
|
|
94
|
+
response: vue.Ref<ApiResponse<LoginResponse> | null>;
|
|
95
|
+
pending: vue.Ref<boolean>;
|
|
96
|
+
post(params?: PostParamsWithoutBody): Promise<ApiResponse<LoginResponse> | null>;
|
|
36
97
|
};
|
|
37
98
|
|
|
38
|
-
|
|
39
|
-
|
|
99
|
+
/** Получить юзера по id */
|
|
100
|
+
declare const useGetUser: () => {
|
|
101
|
+
response: vue.Ref<ApiResponse<User> | null>;
|
|
40
102
|
pending: vue.Ref<boolean>;
|
|
41
103
|
post(params: PostParams<{
|
|
42
104
|
id: number;
|
|
43
|
-
}>): Promise<ApiResponse<
|
|
105
|
+
}>): Promise<ApiResponse<User> | null>;
|
|
106
|
+
};
|
|
107
|
+
/** Получить список юзеров */
|
|
108
|
+
declare const useGetUserList: () => {
|
|
109
|
+
response: vue.Ref<ApiResponse<User[]> | null>;
|
|
110
|
+
pending: vue.Ref<boolean>;
|
|
111
|
+
post(params?: PostParamsWithoutBody): Promise<ApiResponse<User[]> | null>;
|
|
44
112
|
};
|
|
45
113
|
|
|
46
|
-
export { getMode, getToken,
|
|
114
|
+
export { getMode, getToken, removeToken, setMode, setToken, useAccountCheckLogin, useAccountLogin, useAccountLogout, useGetUser, useGetUserList };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
|
|
3
|
-
type Mode =
|
|
4
|
-
declare const mode: vue.Ref<Mode>;
|
|
3
|
+
type Mode = 'development' | 'production';
|
|
5
4
|
declare function setMode(newMode: Mode): void;
|
|
6
5
|
declare function getMode(): Mode;
|
|
7
6
|
declare function setToken(newToken: string): void;
|
|
@@ -28,19 +27,88 @@ type PostParams<Body> = {
|
|
|
28
27
|
body: Body;
|
|
29
28
|
search?: SearchParams;
|
|
30
29
|
};
|
|
30
|
+
type PostParamsWithoutBody = {
|
|
31
|
+
search?: SearchParams;
|
|
32
|
+
};
|
|
31
33
|
|
|
32
|
-
type
|
|
34
|
+
type User = {
|
|
33
35
|
id: number;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
first_name: string;
|
|
37
|
+
last_name: string;
|
|
38
|
+
is_active: true;
|
|
39
|
+
deleted_at: string | null;
|
|
40
|
+
email: string;
|
|
41
|
+
middle_name: string;
|
|
42
|
+
dateofbirth: string;
|
|
43
|
+
phone: number;
|
|
44
|
+
phone_confirmed: boolean;
|
|
45
|
+
status: string;
|
|
46
|
+
passport_serial: number;
|
|
47
|
+
passport_number: number;
|
|
48
|
+
passport_date: Date;
|
|
49
|
+
passport_issuing: string | number;
|
|
50
|
+
passport_division_code: string | number;
|
|
51
|
+
address_country: string | number;
|
|
52
|
+
address_postcode: string | number;
|
|
53
|
+
address_region: string | number;
|
|
54
|
+
address_city: string | number;
|
|
55
|
+
address_street: string | number;
|
|
56
|
+
address_house: string | number;
|
|
57
|
+
address_flat: string | number;
|
|
58
|
+
ILBS_login: string | number;
|
|
59
|
+
cert_serial: string | number;
|
|
60
|
+
groups_ids: [];
|
|
61
|
+
permissions: string[];
|
|
62
|
+
title: string;
|
|
63
|
+
raw_permissions?: string[];
|
|
64
|
+
brokerclient_staff: number[];
|
|
65
|
+
salespoint_staff: number[];
|
|
66
|
+
is_filled_profile: boolean;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
type Login = {
|
|
70
|
+
email: string;
|
|
71
|
+
password: string;
|
|
72
|
+
code?: string;
|
|
73
|
+
};
|
|
74
|
+
type LoginResponse = {
|
|
75
|
+
user: User;
|
|
76
|
+
token: string;
|
|
77
|
+
token_expires: string;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/** Авторизация */
|
|
81
|
+
declare const useAccountLogin: () => {
|
|
82
|
+
response: vue.Ref<ApiResponse<LoginResponse> | null>;
|
|
83
|
+
pending: vue.Ref<boolean>;
|
|
84
|
+
post(params: PostParams<Login>): Promise<ApiResponse<LoginResponse> | null>;
|
|
85
|
+
};
|
|
86
|
+
/** Выход */
|
|
87
|
+
declare const useAccountLogout: () => {
|
|
88
|
+
response: vue.Ref<ApiResponse<unknown> | null>;
|
|
89
|
+
pending: vue.Ref<boolean>;
|
|
90
|
+
post(params: PostParams<unknown>): Promise<ApiResponse<unknown> | null>;
|
|
91
|
+
};
|
|
92
|
+
/** Проверка авторизации */
|
|
93
|
+
declare const useAccountCheckLogin: () => {
|
|
94
|
+
response: vue.Ref<ApiResponse<LoginResponse> | null>;
|
|
95
|
+
pending: vue.Ref<boolean>;
|
|
96
|
+
post(params?: PostParamsWithoutBody): Promise<ApiResponse<LoginResponse> | null>;
|
|
36
97
|
};
|
|
37
98
|
|
|
38
|
-
|
|
39
|
-
|
|
99
|
+
/** Получить юзера по id */
|
|
100
|
+
declare const useGetUser: () => {
|
|
101
|
+
response: vue.Ref<ApiResponse<User> | null>;
|
|
40
102
|
pending: vue.Ref<boolean>;
|
|
41
103
|
post(params: PostParams<{
|
|
42
104
|
id: number;
|
|
43
|
-
}>): Promise<ApiResponse<
|
|
105
|
+
}>): Promise<ApiResponse<User> | null>;
|
|
106
|
+
};
|
|
107
|
+
/** Получить список юзеров */
|
|
108
|
+
declare const useGetUserList: () => {
|
|
109
|
+
response: vue.Ref<ApiResponse<User[]> | null>;
|
|
110
|
+
pending: vue.Ref<boolean>;
|
|
111
|
+
post(params?: PostParamsWithoutBody): Promise<ApiResponse<User[]> | null>;
|
|
44
112
|
};
|
|
45
113
|
|
|
46
|
-
export { getMode, getToken,
|
|
114
|
+
export { getMode, getToken, removeToken, setMode, setToken, useAccountCheckLogin, useAccountLogin, useAccountLogout, useGetUser, useGetUserList };
|
package/dist/index.js
CHANGED
|
@@ -42,11 +42,14 @@ var simpleloan_api_exports = {};
|
|
|
42
42
|
__export(simpleloan_api_exports, {
|
|
43
43
|
getMode: () => getMode,
|
|
44
44
|
getToken: () => getToken,
|
|
45
|
-
mode: () => mode,
|
|
46
45
|
removeToken: () => removeToken,
|
|
47
46
|
setMode: () => setMode,
|
|
48
47
|
setToken: () => setToken,
|
|
49
|
-
|
|
48
|
+
useAccountCheckLogin: () => useAccountCheckLogin,
|
|
49
|
+
useAccountLogin: () => useAccountLogin,
|
|
50
|
+
useAccountLogout: () => useAccountLogout,
|
|
51
|
+
useGetUser: () => useGetUser,
|
|
52
|
+
useGetUserList: () => useGetUserList
|
|
50
53
|
});
|
|
51
54
|
module.exports = __toCommonJS(simpleloan_api_exports);
|
|
52
55
|
|
|
@@ -94,7 +97,7 @@ function getHeaders() {
|
|
|
94
97
|
};
|
|
95
98
|
}
|
|
96
99
|
function getApiUrl() {
|
|
97
|
-
return
|
|
100
|
+
return getMode() === "production" ? "https://portal.simpleloan.ru/api/v1" : "https://slb.medv.ru/api/v1/";
|
|
98
101
|
}
|
|
99
102
|
function getBody(params) {
|
|
100
103
|
return JSON.stringify({
|
|
@@ -131,15 +134,26 @@ function useFetch(url) {
|
|
|
131
134
|
return { post, response, pending };
|
|
132
135
|
}
|
|
133
136
|
|
|
134
|
-
// src/repositories/
|
|
135
|
-
var
|
|
137
|
+
// src/repositories/account/index.ts
|
|
138
|
+
var basePath = "account/";
|
|
139
|
+
var useAccountLogin = () => useFetch(basePath + "login/");
|
|
140
|
+
var useAccountLogout = () => useFetch(basePath + "logout/");
|
|
141
|
+
var useAccountCheckLogin = () => useFetch(basePath + "check_login/");
|
|
142
|
+
|
|
143
|
+
// src/repositories/user/index.ts
|
|
144
|
+
var baseUrl = "user/";
|
|
145
|
+
var useGetUser = () => useFetch(baseUrl + "get");
|
|
146
|
+
var useGetUserList = () => useFetch(baseUrl + "get_list");
|
|
136
147
|
// Annotate the CommonJS export names for ESM import in node:
|
|
137
148
|
0 && (module.exports = {
|
|
138
149
|
getMode,
|
|
139
150
|
getToken,
|
|
140
|
-
mode,
|
|
141
151
|
removeToken,
|
|
142
152
|
setMode,
|
|
143
153
|
setToken,
|
|
144
|
-
|
|
154
|
+
useAccountCheckLogin,
|
|
155
|
+
useAccountLogin,
|
|
156
|
+
useAccountLogout,
|
|
157
|
+
useGetUser,
|
|
158
|
+
useGetUserList
|
|
145
159
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -63,7 +63,7 @@ function getHeaders() {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
function getApiUrl() {
|
|
66
|
-
return
|
|
66
|
+
return getMode() === "production" ? "https://portal.simpleloan.ru/api/v1" : "https://slb.medv.ru/api/v1/";
|
|
67
67
|
}
|
|
68
68
|
function getBody(params) {
|
|
69
69
|
return JSON.stringify({
|
|
@@ -100,14 +100,25 @@ function useFetch(url) {
|
|
|
100
100
|
return { post, response, pending };
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
// src/repositories/
|
|
104
|
-
var
|
|
103
|
+
// src/repositories/account/index.ts
|
|
104
|
+
var basePath = "account/";
|
|
105
|
+
var useAccountLogin = () => useFetch(basePath + "login/");
|
|
106
|
+
var useAccountLogout = () => useFetch(basePath + "logout/");
|
|
107
|
+
var useAccountCheckLogin = () => useFetch(basePath + "check_login/");
|
|
108
|
+
|
|
109
|
+
// src/repositories/user/index.ts
|
|
110
|
+
var baseUrl = "user/";
|
|
111
|
+
var useGetUser = () => useFetch(baseUrl + "get");
|
|
112
|
+
var useGetUserList = () => useFetch(baseUrl + "get_list");
|
|
105
113
|
export {
|
|
106
114
|
getMode,
|
|
107
115
|
getToken,
|
|
108
|
-
mode,
|
|
109
116
|
removeToken,
|
|
110
117
|
setMode,
|
|
111
118
|
setToken,
|
|
112
|
-
|
|
119
|
+
useAccountCheckLogin,
|
|
120
|
+
useAccountLogin,
|
|
121
|
+
useAccountLogout,
|
|
122
|
+
useGetUser,
|
|
123
|
+
useGetUserList
|
|
113
124
|
};
|