Client
The demo replacement for @/shared/api/client, aliased
in only for --mode demo. apiFetch answers reads from fixtures, routes the
job and profile-collection writes to the simulator / session store, and the
upload helpers fake progress. API_BASE is base-aware so bundled /api/...
fixtures resolve under --base=/mirumoji/ on GitHub Pages.
Variables¶
API_BASE¶
Defined in: src/demo/api/client.ts:15
VITE_API_BASE override, else base-aware so /api/... resolves under the Pages base prefix.
UPLOAD_ABORTED_CODE¶
Defined in: src/demo/api/client.ts:100
Mirrors the real client's cancelled-upload code, so the shared upload paths can tell a deliberate cancel apart from a failure here too.
Functions¶
apiFetch()¶
Defined in: src/demo/api/client.ts:27
Fixture-backed fetch replacement mirroring the real apiFetch contract.
Type Parameters¶
| Type Parameter | Default type |
|---|---|
T |
unknown |
Parameters¶
| Parameter | Type |
|---|---|
url |
string |
opts |
RequestInit |
Returns¶
Promise\<T>
isUploadAborted()¶
Defined in: src/demo/api/client.ts:108
Whether an error is an upload the caller cancelled, rather than a failure.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
error |
unknown |
The caught error. |
Returns¶
boolean
true when the upload was aborted deliberately.
uploadFile()¶
Defined in: src/demo/api/client.ts:126
Fakes a profile-file upload; the file bytes are ignored (the sample is canned).
Type Parameters¶
| Type Parameter | Default type |
|---|---|
T |
unknown |
Parameters¶
| Parameter | Type |
|---|---|
file |
File |
url |
string |
_headers |
Record\<string, string> |
onProgress |
(percent) => void |
onUploadComplete |
() => void |
signal? |
AbortSignal |
Returns¶
Promise\<T>
uploadFormData()¶
Defined in: src/demo/api/client.ts:142
Fakes a multipart upload; for a saved clip the recorded blob is played back locally.
Type Parameters¶
| Type Parameter | Default type |
|---|---|
T |
unknown |
Parameters¶
| Parameter | Type |
|---|---|
_url |
string |
formData |
FormData |
onProgress |
(percent) => void |
onUploadComplete |
() => void |
signal? |
AbortSignal |
Returns¶
Promise\<T>