File tree Expand file tree Collapse file tree 3 files changed +24
-13
lines changed
templates/react-native/src Expand file tree Collapse file tree 3 files changed +24
-13
lines changed Original file line number Diff line number Diff line change @@ -338,10 +338,6 @@ class Client {
338
338
credentials: 'include'
339
339
};
340
340
341
- if (typeof window !== 'undefined' && window.localStorage) {
342
- headers['X-Fallback-Cookies'] = window.localStorage.getItem('cookieFallback') ?? '';
343
- }
344
-
345
341
if (method === 'GET') {
346
342
for (const [key, value] of Object.entries(Service.flatten(params))) {
347
343
url.searchParams.append(key, value);
Original file line number Diff line number Diff line change 1
1
export class ID {
2
+ // Generate an hex ID based on timestamp
3
+ // Recreated from https://www.php.net/manual/en/function.uniqid.php
4
+ static #hexTimestamp(): string {
5
+ const now = new Date();
6
+ const sec = Math.floor(now.getTime() / 1000);
7
+ const msec = now.getMilliseconds();
8
+
9
+ // Convert to hexadecimal
10
+ const hexTimestamp = sec.toString(16) + msec.toString(16).padStart(5, '0');
11
+ return hexTimestamp;
12
+ }
13
+
2
14
public static custom(id: string): string {
3
15
return id
4
16
}
5
-
6
- public static unique(): string {
7
- return 'unique()'
17
+
18
+ public static unique(padding: number = 7): string {
19
+ // Generate a unique ID with padding to have a longer ID
20
+ const baseId = ID.#hexTimestamp();
21
+ let randomPadding = '';
22
+ for (let i = 0; i < padding; i++) {
23
+ const randomHexDigit = Math.floor(Math.random() * 16).toString(16);
24
+ randomPadding += randomHexDigit;
25
+ }
26
+ return baseId + randomPadding;
8
27
}
9
- }
28
+ }
Original file line number Diff line number Diff line change @@ -84,11 +84,7 @@ export class {{ service.name | caseUcfirst }} extends Service {
84
84
}
85
85
{% endif %}
86
86
{% if method .type == ' webAuth' %}
87
- if (typeof window !== 'undefined' && window?.location) {
88
- window.location.href = uri.toString();
89
- } else {
90
- return uri;
91
- }
87
+ throw new {{ spec .title | caseUcfirst }}Exception('Not yet supported');
92
88
{% elseif method .type == ' location' %}
93
89
return uri;
94
90
{% else %}
You can’t perform that action at this time.
0 commit comments