@remix-run/router 1.0.3 → 1.0.4-pre.1
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/CHANGELOG.md +16 -0
- package/dist/history.d.ts +3 -3
- package/dist/router.cjs.js +262 -166
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +14 -2
- package/dist/router.js +262 -166
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +262 -166
- package/dist/router.umd.js.map +1 -1
- package/dist/router.umd.min.js +2 -2
- package/dist/router.umd.min.js.map +1 -1
- package/dist/utils.d.ts +7 -3
- package/history.ts +12 -8
- package/package.json +1 -1
- package/router.ts +292 -183
- package/utils.ts +21 -5
package/utils.ts
CHANGED
|
@@ -41,6 +41,7 @@ export interface RedirectResult {
|
|
|
41
41
|
status: number;
|
|
42
42
|
location: string;
|
|
43
43
|
revalidate: boolean;
|
|
44
|
+
external: boolean;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
/**
|
|
@@ -61,7 +62,9 @@ export type DataResult =
|
|
|
61
62
|
| RedirectResult
|
|
62
63
|
| ErrorResult;
|
|
63
64
|
|
|
64
|
-
export type
|
|
65
|
+
export type SubmissionFormMethod = "post" | "put" | "patch" | "delete";
|
|
66
|
+
export type FormMethod = "get" | SubmissionFormMethod;
|
|
67
|
+
|
|
65
68
|
export type FormEncType =
|
|
66
69
|
| "application/x-www-form-urlencoded"
|
|
67
70
|
| "multipart/form-data";
|
|
@@ -72,7 +75,7 @@ export type FormEncType =
|
|
|
72
75
|
* external consumption
|
|
73
76
|
*/
|
|
74
77
|
export interface Submission {
|
|
75
|
-
formMethod:
|
|
78
|
+
formMethod: SubmissionFormMethod;
|
|
76
79
|
formAction: string;
|
|
77
80
|
formEncType: FormEncType;
|
|
78
81
|
formData: FormData;
|
|
@@ -1243,11 +1246,24 @@ export class ErrorResponse {
|
|
|
1243
1246
|
status: number;
|
|
1244
1247
|
statusText: string;
|
|
1245
1248
|
data: any;
|
|
1246
|
-
|
|
1247
|
-
|
|
1249
|
+
error?: Error;
|
|
1250
|
+
internal: boolean;
|
|
1251
|
+
|
|
1252
|
+
constructor(
|
|
1253
|
+
status: number,
|
|
1254
|
+
statusText: string | undefined,
|
|
1255
|
+
data: any,
|
|
1256
|
+
internal = false
|
|
1257
|
+
) {
|
|
1248
1258
|
this.status = status;
|
|
1249
1259
|
this.statusText = statusText || "";
|
|
1250
|
-
this.
|
|
1260
|
+
this.internal = internal;
|
|
1261
|
+
if (data instanceof Error) {
|
|
1262
|
+
this.data = data.toString();
|
|
1263
|
+
this.error = data;
|
|
1264
|
+
} else {
|
|
1265
|
+
this.data = data;
|
|
1266
|
+
}
|
|
1251
1267
|
}
|
|
1252
1268
|
}
|
|
1253
1269
|
|