---
name: "redirectTo"
mode: "kit"
versionRequirements:
  - { name: "MiniKit", version: "1.0.0" }
platform:
  - "iOS"
  - "Android"
async: true
---

## redirectTo

> [VERSION] MiniKit >= 1.0.0

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Close the current page and navigate to a page within the app

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `url` | `string` | Yes | - | `1.0.0` | Page path; parameters must be URL-encoded |
| `complete` | `() => void` | No | - | - | Complete callback (executed on success or failure) |
| `success` | `() => void` | No | - | - | Success callback |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extensions |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Extended error code |
| `errorMsg` | `string` | Extended error information |


### Examples

```tsx
ty.redirectTo({
  url: "pages/index/index",
  success: data => { console.log(data); },
  fail: error => { console.error(error); },
});
```
