-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72c2a7d
commit 6b33714
Showing
11 changed files
with
492 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/playground/react-sample/fake/sync-request.fake.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { defineFakeRoute } from "vite-plugin-fake-server/client"; | ||
|
||
import { resultSuccess } from "./nest/utils"; | ||
|
||
export default defineFakeRoute({ | ||
url: "/sync-request", | ||
/** | ||
* The sleep function for synchronous requests will block the browser's rendering. | ||
* When making a synchronous request, it is recommended to set the delay to 0. | ||
*/ | ||
timeout: 0, | ||
response: () => { | ||
return resultSuccess({ | ||
timestamp: Date.now(), | ||
status: "success", | ||
code: 200, | ||
message: "ok", | ||
data: { | ||
description: ` | ||
The sleep function for synchronous requests will block the browser's rendering. | ||
When making a synchronous request, it is recommended to set the delay to 0. | ||
`, | ||
}, | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/playground/react-sample/src/components/the-nav/type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Request method type | ||
type Method = "GET" | "POST" | "PUT" | "DELETE"; | ||
|
||
// Response type | ||
type ResponseType = "xml" | undefined; | ||
|
||
// Request header value type | ||
type HeaderValue = string; | ||
|
||
// Option interface | ||
export interface Option { | ||
type?: "XHR" | "Fetch" | ||
// Displayed label text | ||
label: string | ||
// Value/path | ||
value: string | ||
// HTTP method | ||
method: Method | ||
// Sync request | ||
sync?: boolean | ||
// Optional response type | ||
responseType?: ResponseType | ||
// Optional request headers | ||
headers?: Record<string, HeaderValue> | ||
// Optional request body | ||
body?: Record<string, unknown> | ||
// Only use XHR | ||
onlyXHR?: boolean | ||
// Optional disabled status | ||
disabled?: boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.