2023-09-29 20:25:24 +02:00
|
|
|
import { TServerResponse } from "~/lib/response";
|
2023-09-29 20:24:08 +02:00
|
|
|
|
|
|
|
export function success(_path: RequestInfo | URL, _options?: RequestInit) {
|
|
|
|
const json = () => (
|
|
|
|
new Promise<TServerResponse>((resolve) => (
|
|
|
|
resolve({
|
2023-10-01 13:42:21 +02:00
|
|
|
YourIPAddress: "127.0.0.1",
|
|
|
|
YourISP: "FooBar Ltd",
|
|
|
|
YourCity: "Foo City",
|
|
|
|
YourCountry: "United States of FooBar",
|
|
|
|
YourTorExit: false
|
2023-09-29 20:24:08 +02:00
|
|
|
})
|
|
|
|
)
|
2023-09-29 20:25:24 +02:00
|
|
|
));
|
2023-09-29 20:24:08 +02:00
|
|
|
|
|
|
|
return new Promise<any>((resolve) => {
|
2023-09-29 20:25:24 +02:00
|
|
|
resolve({ status: 200, json });
|
2023-09-29 20:24:08 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export function error(_path: RequestInfo | URL, _options?: RequestInit) {
|
|
|
|
return new Promise<any>(() => {
|
|
|
|
throw new Error("Request error");
|
2023-09-29 20:25:24 +02:00
|
|
|
});
|
|
|
|
}
|
2023-09-29 20:24:08 +02:00
|
|
|
|
|
|
|
export function loading(_path: RequestInfo | URL, _options?: RequestInit) {
|
|
|
|
return new Promise<any>(() => null);
|
|
|
|
}
|