robbyson-frontend-library 0.0.1-rc2 → 0.0.1-rc4
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.
|
@@ -177,6 +177,15 @@ var BaseRepository = /** @class */ (function () {
|
|
|
177
177
|
config.headers['x-system-id'] = BaseRepository._systemId;
|
|
178
178
|
return config;
|
|
179
179
|
};
|
|
180
|
+
BaseRepository.prototype.createAxiosCancelationContext = function () {
|
|
181
|
+
BaseRepository._source = axios.CancelToken.source();
|
|
182
|
+
};
|
|
183
|
+
BaseRepository.prototype.cancelAxiosRequest = function () {
|
|
184
|
+
if (BaseRepository._source) {
|
|
185
|
+
BaseRepository._source.cancel();
|
|
186
|
+
BaseRepository._source = null;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
180
189
|
BaseRepository._sessionKey = "";
|
|
181
190
|
BaseRepository._systemId = 1;
|
|
182
191
|
BaseRepository._baseURL = "";
|
|
@@ -25,6 +25,25 @@ var RobbysonNavigate = /** @class */ (function () {
|
|
|
25
25
|
var history = RobbysonNavigate._globalState.Global.RootApp.history;
|
|
26
26
|
history.replace(replace, state);
|
|
27
27
|
};
|
|
28
|
+
RobbysonNavigate.getRouteId = function () {
|
|
29
|
+
RobbysonNavigate._globalStore = GlobalStore.Get();
|
|
30
|
+
RobbysonNavigate._globalState =
|
|
31
|
+
RobbysonNavigate._globalStore.GetGlobalState();
|
|
32
|
+
var history = RobbysonNavigate._globalState.Global.RootApp.history;
|
|
33
|
+
var routeParams = history.location.pathname.split("/");
|
|
34
|
+
var id = routeParams[routeParams.length - 1];
|
|
35
|
+
return id;
|
|
36
|
+
};
|
|
37
|
+
RobbysonNavigate.getPathname = function () {
|
|
38
|
+
RobbysonNavigate._globalStore = GlobalStore.Get();
|
|
39
|
+
RobbysonNavigate._globalState =
|
|
40
|
+
RobbysonNavigate._globalStore.GetGlobalState();
|
|
41
|
+
var history = RobbysonNavigate._globalState.Global.RootApp.history;
|
|
42
|
+
return history.location.pathname;
|
|
43
|
+
};
|
|
44
|
+
RobbysonNavigate.matchPath = function (path) {
|
|
45
|
+
return RobbysonNavigate.getPathname().includes(path);
|
|
46
|
+
};
|
|
28
47
|
RobbysonNavigate.getQueryParams = function () {
|
|
29
48
|
RobbysonNavigate._globalStore = GlobalStore.Get();
|
|
30
49
|
RobbysonNavigate._globalState =
|
package/package.json
CHANGED
|
@@ -125,4 +125,15 @@ export class BaseRepository {
|
|
|
125
125
|
|
|
126
126
|
return config;
|
|
127
127
|
}
|
|
128
|
+
|
|
129
|
+
protected createAxiosCancelationContext(): void {
|
|
130
|
+
BaseRepository._source = axios.CancelToken.source();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
protected cancelAxiosRequest(): void {
|
|
134
|
+
if (BaseRepository._source) {
|
|
135
|
+
BaseRepository._source.cancel();
|
|
136
|
+
BaseRepository._source = null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
128
139
|
}
|
|
@@ -38,6 +38,33 @@ export class RobbysonNavigate {
|
|
|
38
38
|
history.replace(replace, state);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
static getRouteId(): string {
|
|
42
|
+
RobbysonNavigate._globalStore = GlobalStore.Get();
|
|
43
|
+
RobbysonNavigate._globalState =
|
|
44
|
+
RobbysonNavigate._globalStore.GetGlobalState();
|
|
45
|
+
|
|
46
|
+
const { history } = RobbysonNavigate._globalState.Global.RootApp;
|
|
47
|
+
|
|
48
|
+
const routeParams = history.location.pathname.split("/");
|
|
49
|
+
const id = routeParams[routeParams.length - 1];
|
|
50
|
+
|
|
51
|
+
return id;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static getPathname(): string {
|
|
55
|
+
RobbysonNavigate._globalStore = GlobalStore.Get();
|
|
56
|
+
RobbysonNavigate._globalState =
|
|
57
|
+
RobbysonNavigate._globalStore.GetGlobalState();
|
|
58
|
+
|
|
59
|
+
const { history } = RobbysonNavigate._globalState.Global.RootApp;
|
|
60
|
+
|
|
61
|
+
return history.location.pathname;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static matchPath(path: string): boolean {
|
|
65
|
+
return RobbysonNavigate.getPathname().includes(path)
|
|
66
|
+
}
|
|
67
|
+
|
|
41
68
|
static getQueryParams<T>(): T {
|
|
42
69
|
RobbysonNavigate._globalStore = GlobalStore.Get();
|
|
43
70
|
RobbysonNavigate._globalState =
|