Compare commits
209 Commits
@nhost/rea
...
@nhost/rea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d212128815 | ||
|
|
9d9caf9834 | ||
|
|
96cbf023ca | ||
|
|
1ed534cb4a | ||
|
|
dcdee0b426 | ||
|
|
e31f4756b4 | ||
|
|
259e198d80 | ||
|
|
1d10a47414 | ||
|
|
f30d6779bb | ||
|
|
2a3b2c3af5 | ||
|
|
a0db6b58de | ||
|
|
523d52aa7f | ||
|
|
6e1ee1802d | ||
|
|
51ad1eb355 | ||
|
|
ee2dd8481b | ||
|
|
b8e787cb47 | ||
|
|
2ef5c238c1 | ||
|
|
e084643032 | ||
|
|
5514e81186 | ||
|
|
16f38aa893 | ||
|
|
76c6e8d0d6 | ||
|
|
197d1d5cfc | ||
|
|
abd43d0a8b | ||
|
|
70383c8c80 | ||
|
|
a7d5c85f60 | ||
|
|
bc657251d6 | ||
|
|
5abc362a4d | ||
|
|
7a4c9fa806 | ||
|
|
348318d709 | ||
|
|
b5f7f7fe5f | ||
|
|
7116a4df8a | ||
|
|
7e4c52dbd1 | ||
|
|
446dc01bde | ||
|
|
a1989c51f8 | ||
|
|
1383de558a | ||
|
|
d828107f74 | ||
|
|
4a1650cb35 | ||
|
|
913651d440 | ||
|
|
6af2d52666 | ||
|
|
da7c2a2362 | ||
|
|
4a7940b59a | ||
|
|
ddda8bb031 | ||
|
|
b146e60f7e | ||
|
|
5591789840 | ||
|
|
fac5ddb866 | ||
|
|
f2fab8dac2 | ||
|
|
6e3f2c382d | ||
|
|
05385d01dc | ||
|
|
7ea72b799c | ||
|
|
4936261cee | ||
|
|
80902b9cf1 | ||
|
|
c3af490e67 | ||
|
|
6a24e32857 | ||
|
|
0ebddd30cf | ||
|
|
d019f1de21 | ||
|
|
3abb57f510 | ||
|
|
4a2ad15f14 | ||
|
|
ca45b612c9 | ||
|
|
27ee9b721f | ||
|
|
2a373dd50f | ||
|
|
a91f714c4c | ||
|
|
3b4d89d5b6 | ||
|
|
16d1b26298 | ||
|
|
86d8beb044 | ||
|
|
17f870f31f | ||
|
|
fbfffe25ca | ||
|
|
87a472b27e | ||
|
|
779b03b0b2 | ||
|
|
9d933b6ffd | ||
|
|
34d643868d | ||
|
|
0023f5f6f6 | ||
|
|
48f5c8bfb9 | ||
|
|
f398b2e3ac | ||
|
|
11795abe61 | ||
|
|
e2eafc9ee1 | ||
|
|
4a5a2fac43 | ||
|
|
4a908af7ef | ||
|
|
a7b6498053 | ||
|
|
7f418a7559 | ||
|
|
8493129750 | ||
|
|
26b817c5fa | ||
|
|
e61ea19421 | ||
|
|
401f2cb540 | ||
|
|
6363a289fb | ||
|
|
f09037ccef | ||
|
|
a4dea7339e | ||
|
|
50474810bf | ||
|
|
f356c7176b | ||
|
|
cb99c6d989 | ||
|
|
7cef49bb02 | ||
|
|
6eaa5c7920 | ||
|
|
64574ee892 | ||
|
|
d3d38b2631 | ||
|
|
023afae3cd | ||
|
|
19d2242918 | ||
|
|
ead2c16aac | ||
|
|
a5f02e8056 | ||
|
|
aeb85a1e01 | ||
|
|
821912e23e | ||
|
|
8608a78eaf | ||
|
|
2d2da4f6e0 | ||
|
|
19d7262b05 | ||
|
|
1c750bd652 | ||
|
|
8a3943a942 | ||
|
|
62385a7866 | ||
|
|
9e21de3819 | ||
|
|
c101a26ce5 | ||
|
|
21fa83d115 | ||
|
|
522839d8f7 | ||
|
|
87aad599f3 | ||
|
|
5b097e635d | ||
|
|
bfdcacd5a3 | ||
|
|
dcb9055475 | ||
|
|
6f0bf3d67c | ||
|
|
3c96c561a0 | ||
|
|
3d319364f3 | ||
|
|
80468ac3ac | ||
|
|
d03653f1fd | ||
|
|
a7f3599fb1 | ||
|
|
c789102189 | ||
|
|
b638173181 | ||
|
|
d65df02adb | ||
|
|
5dff7ad5d3 | ||
|
|
9263bea2ae | ||
|
|
4f994b536e | ||
|
|
4f9287562e | ||
|
|
58f82f9aad | ||
|
|
c907021313 | ||
|
|
12a218b12c | ||
|
|
196156ff93 | ||
|
|
28ca032f70 | ||
|
|
38462c45b6 | ||
|
|
8e03ed43b7 | ||
|
|
333292ab89 | ||
|
|
b4d52debff | ||
|
|
287e48a51a | ||
|
|
9370e06b68 | ||
|
|
d5b775c630 | ||
|
|
ea8e1df8da | ||
|
|
20005986a9 | ||
|
|
ced8100168 | ||
|
|
36d6db526c | ||
|
|
fb53e94193 | ||
|
|
c1d722390f | ||
|
|
165ff16cdc | ||
|
|
111d6d99a1 | ||
|
|
dabbb6ec0d | ||
|
|
7174aa1384 | ||
|
|
e3ef4a0188 | ||
|
|
82ac9b9684 | ||
|
|
bd494434d9 | ||
|
|
0ee47821cd | ||
|
|
0dc01a99e9 | ||
|
|
3a04c272ee | ||
|
|
0e782b8e99 | ||
|
|
3e9d864899 | ||
|
|
dd38973515 | ||
|
|
9ab5b7a927 | ||
|
|
406132902d | ||
|
|
7503b0d840 | ||
|
|
d42cb698c1 | ||
|
|
73e4702a1a | ||
|
|
93cc6bc1cf | ||
|
|
db955e3b71 | ||
|
|
c944ef11e4 | ||
|
|
d9e2e41efd | ||
|
|
1219356c8f | ||
|
|
2eb7467afa | ||
|
|
12f42319f9 | ||
|
|
a898a19ffa | ||
|
|
5f05d46c3d | ||
|
|
bfcabe8e73 | ||
|
|
233a6e4bd6 | ||
|
|
577792b3d5 | ||
|
|
3ba026e7d7 | ||
|
|
fa740867c5 | ||
|
|
a417c8468a | ||
|
|
2dc020a676 | ||
|
|
f49d14cc1b | ||
|
|
2d1185f7ec | ||
|
|
c6d4c5e943 | ||
|
|
0a536ccfda | ||
|
|
d20bfe3431 | ||
|
|
dcf5e28e06 | ||
|
|
5c10169972 | ||
|
|
abdbbe6fcc | ||
|
|
479a2ed08d | ||
|
|
3db941eb46 | ||
|
|
42a7aaf916 | ||
|
|
2443399cdc | ||
|
|
de81942fb2 | ||
|
|
5a60c5cb29 | ||
|
|
752812a321 | ||
|
|
0af2337499 | ||
|
|
b238bd7b6b | ||
|
|
f87403108f | ||
|
|
20f8fe9eb4 | ||
|
|
6f6044c49c | ||
|
|
4ffb14b240 | ||
|
|
f9854b15c4 | ||
|
|
cf206a4d1c | ||
|
|
eae285bfc9 | ||
|
|
51a115eaf7 | ||
|
|
da9c043fb5 | ||
|
|
e821af279a | ||
|
|
1d3469a455 | ||
|
|
9ff668d26c | ||
|
|
8f100e6e56 | ||
|
|
42dc93100c |
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx lint-staged
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"packages/(docgen|hasura-auth-js|hasura-storage-js|nextjs|nhost-js|react|core|vue)/src/**/*.{js,ts,jsx,tsx}": [
|
||||
"pnpm docgen",
|
||||
"git add docs"
|
||||
]
|
||||
}
|
||||
34
README.md
34
README.md
@@ -147,13 +147,6 @@ Here are some ways of contributing to making Nhost better:
|
||||
<sub><b>Johan Eliasson</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/szilarddoro">
|
||||
<img src="https://avatars.githubusercontent.com/u/310881?v=4" width="100;" alt="szilarddoro"/>
|
||||
<br />
|
||||
<sub><b>Szilárd Dóró</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/gdangelo">
|
||||
<img src="https://avatars.githubusercontent.com/u/4352286?v=4" width="100;" alt="gdangelo"/>
|
||||
@@ -174,15 +167,15 @@ Here are some ways of contributing to making Nhost better:
|
||||
<br />
|
||||
<sub><b>Guido Curcio</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/subatuba21">
|
||||
<img src="https://avatars.githubusercontent.com/u/34824571?v=4" width="100;" alt="subatuba21"/>
|
||||
<br />
|
||||
<sub><b>Subha Das</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/sebagudelo">
|
||||
<img src="https://avatars.githubusercontent.com/u/43288271?v=4" width="100;" alt="sebagudelo"/>
|
||||
@@ -204,6 +197,13 @@ Here are some ways of contributing to making Nhost better:
|
||||
<sub><b>Pratim</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/szilarddoro">
|
||||
<img src="https://avatars.githubusercontent.com/u/310881?v=4" width="100;" alt="szilarddoro"/>
|
||||
<br />
|
||||
<sub><b>Szilárd Dóró</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/FuzzyReason">
|
||||
<img src="https://avatars.githubusercontent.com/u/62517920?v=4" width="100;" alt="FuzzyReason"/>
|
||||
@@ -391,6 +391,13 @@ Here are some ways of contributing to making Nhost better:
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/nachoaldamav">
|
||||
<img src="https://avatars.githubusercontent.com/u/22749943?v=4" width="100;" alt="nachoaldamav"/>
|
||||
<br />
|
||||
<sub><b>Nacho Aldama</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/ghoshnirmalya">
|
||||
<img src="https://avatars.githubusercontent.com/u/6391763?v=4" width="100;" alt="ghoshnirmalya"/>
|
||||
@@ -412,6 +419,13 @@ Here are some ways of contributing to making Nhost better:
|
||||
<sub><b>Tapas Adhikary</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/uulwake">
|
||||
<img src="https://avatars.githubusercontent.com/u/22399181?v=4" width="100;" alt="uulwake"/>
|
||||
<br />
|
||||
<sub><b>Ulrich Wake</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/komninoschat">
|
||||
<img src="https://avatars.githubusercontent.com/u/29049104?v=4" width="100;" alt="komninoschat"/>
|
||||
|
||||
4
config/.husky/pre-commit
Executable file
4
config/.husky/pre-commit
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx lint-staged --config config/.lintstagedrc.js
|
||||
8
config/.lintstagedrc.js
Normal file
8
config/.lintstagedrc.js
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
'packages/(docgen|hasura-auth-js|hasura-storage-js|nextjs|nhost-js|react|core|vue)/src/**/*.{js,ts,jsx,tsx}':
|
||||
['pnpm docgen', 'git add docs'],
|
||||
'(nhost-cloud.yaml|**/nhost/config.yaml)': () => [
|
||||
'pnpm sync-versions',
|
||||
"git add ':(glob)**/nhost/config.yaml'"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
title: Sign In with Apple
|
||||
sidebar_label: Apple
|
||||
slug: /platform/authentication/sign-in-with-apple
|
||||
image: /img/og/platform/sign-in-with-apple.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with Apple with your Nhost App.
|
||||
|
||||
<p align="center">
|
||||
<img
|
||||
alt="Apple Sign In Preview"
|
||||
src="/img/social-providers/apple-preview.svg"
|
||||
width={480}
|
||||
height={267}
|
||||
/>
|
||||
</p>
|
||||
|
||||
## Create Apple Developer Account
|
||||
|
||||
- Click on "Account" in the top menu.
|
||||
- Create a new [Apple Developer account](https://developer.apple.com) if you don't have one already and sign in to the Apple Developer platform.
|
||||
|
||||
## Get an App ID
|
||||
|
||||
- Go to the [Apple Developer Dashboard](https://developer.apple.com/account/).
|
||||
- Click on **Certificates, IDs & Profiles** in the left menu.
|
||||
- Click on **Identifiers** in the left menu.
|
||||
- Click on the "+" button in the header next to "Identifiers".
|
||||
- Select **App IDs** and click **Continue**.
|
||||
- Select type **App** and click **Continue**.
|
||||
- Fill in the App information:
|
||||
|
||||
- Description.
|
||||
- Bundle ID (ex. io.nhost.app or com.your-startup.app).
|
||||
- Scroll down and check **Sign In With Apple**.
|
||||
- Click **Continue** in the top right corner.
|
||||
- Click **Register** in the top right corner.
|
||||
|
||||
- Click on the newly created app to see **Team ID**.
|
||||
|
||||
- **Team ID**: Copy and paste the **Team ID** to your Nhost OAuth settings for Apple.
|
||||
|
||||
## Get a Service ID
|
||||
|
||||
- Go to the [Apple Developer Dashboard](https://developer.apple.com/account/).
|
||||
- Click on **Certificates, IDs & Profiles** in the left menu.
|
||||
- Click on **Identifiers** in the left menu.
|
||||
- Click on **Certificates, IDs & Profiles** in the left menu.
|
||||
- Click on **Identifiers** in the left menu.
|
||||
- Click on the "+" button in the header next to "Identifiers".
|
||||
- Select **Service IDs** and click **Continue**.
|
||||
|
||||
- Fill in the Service information:
|
||||
|
||||
- Description.
|
||||
- Identifier (Service ID) (ex. _service_.io.nhost.app or _service_.com.your-startup.app). Notice you can't use the same identifier as for the app so we recommend adding "service" at the beginning if the identifier.
|
||||
- **Service ID**: Copy and paste the **Identifier (Service ID)** to your Nhost OAuth settings for Apple.
|
||||
- Click **Continue** in the top right corner.
|
||||
- Click **Register** in the top right corner.
|
||||
|
||||
- Click on the newly created service in the list of Identifiers.
|
||||
- Click the checkbox to enable "Sign in with Apple".
|
||||
- Click **Configure** next to "Sign in with Apple".
|
||||
- Make sure your newly created Bundle ID is selected under Primary App ID.
|
||||
- Add your base auth domain under "Domains and Subdomains". E.g. `<subdomain>.nhost.run`.
|
||||
- Add the full callback URL under "Return URLs". E.g. `https://<subdomain>.nhost.run/v1/auth/signin/provider/apple/callback`.
|
||||
- Click **Next**.
|
||||
- Click **Done**.
|
||||
- Click **Continue** in the top right corner.
|
||||
- Click **Save** in the top right corner.
|
||||
|
||||
## Generate Key
|
||||
|
||||
- Go to the [Apple Developer Dashboard](https://developer.apple.com/account/).
|
||||
- Click on **Certificates, IDs & Profiles** in the left menu.
|
||||
- Click on **Keys** in the left menu.
|
||||
- Click on **Create a key**.
|
||||
- Fill in a name for your key.
|
||||
- Click the checkbox to enable "Sign in with Apple".
|
||||
- Click **Configure** next to "Sign in with Apple".
|
||||
- Select your newly created App ID in the dropdown selector.
|
||||
- Click **Save** in the top right corner.
|
||||
- Click **Continue** in the top right corner.
|
||||
- Click **Register** in the top right corner.
|
||||
- **Key ID**: Copy and paste the **Key ID** to your Nhost OAuth settings for Apple.
|
||||
- Click **Download** to download the key to your computer.
|
||||
- **Private Key**: Copy and paste the content of the downloaded key to your Nhost OAuth settings for Apple.
|
||||
|
||||
## Sign In Users
|
||||
|
||||
Use the [Nhost JavaScript client](/reference/javascript) to sign in users in your app:
|
||||
|
||||
```js
|
||||
nhost.auth.signIn({
|
||||
provider: 'apple'
|
||||
})
|
||||
```
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: Sign In with Discord
|
||||
sidebar_label: Discord
|
||||
slug: /platform/authentication/sign-in-with-discord
|
||||
image: /img/og/platform/sign-in-with-discord.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with Discord with your Nhost App.
|
||||
|
||||
<p align="center">
|
||||
<img
|
||||
alt="Discord Sign In Preview"
|
||||
src="/img/social-providers/discord-preview.svg"
|
||||
width={480}
|
||||
height={267}
|
||||
/>
|
||||
</p>
|
||||
|
||||
## Create Discord Account
|
||||
|
||||
- Create a new [Discord account](https://discord.com/) if you don't have one already.
|
||||
|
||||
## Create Discord App
|
||||
|
||||
- Sign in to the [Discord Developer Portal](https://discord.com/developers/applications).
|
||||
- Click on **New Application** in the top right corner.
|
||||
- Fill in the name of your Discord Application and click **Create**.
|
||||
- Click on **OAuth2** settings in the left menu.
|
||||
- Copy the **Client ID** and paste it into your Nhost OAuth settings for Discord.
|
||||
- Click on **Reset Secret**.
|
||||
- Click **Yes, do it** to generate a new secret.
|
||||
- Copy the **Client Secret** and paste it into your Nhost OAuth settings for Discord.
|
||||
- Click on **Add Redirect**.
|
||||
- Copy and paste the callback URL from your Nhost OAuth settings for Discord to the input field in the Discord Developer portal.
|
||||
- Click **Save Changes** to save the added callback URL.
|
||||
|
||||
## Sign In Users
|
||||
|
||||
Use the [Nhost JavaScript client](/reference/javascript) to sign in users in your app:
|
||||
|
||||
```js
|
||||
nhost.auth.signIn({
|
||||
provider: 'discord'
|
||||
})
|
||||
```
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: Sign In with Twitch
|
||||
sidebar_label: Twitch
|
||||
slug: /platform/authentication/sign-in-with-twitch
|
||||
image: /img/og/platform/sign-in-with-twitch.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with Twitch with your Nhost App.
|
||||
|
||||
<p align="center">
|
||||
<img
|
||||
alt="Twitch Sign In Preview"
|
||||
src="/img/social-providers/twitch-preview.svg"
|
||||
width={480}
|
||||
height={267}
|
||||
/>
|
||||
</p>
|
||||
|
||||
## Create Twitch Account
|
||||
|
||||
- Create a new [Twitch account](https://twitch.tv/) if you don't have one already.
|
||||
|
||||
## Create Twitch App
|
||||
|
||||
- Sign in to the [Twitch Developer Console](https://dev.twitch.tv/console).
|
||||
- Click on **Register Your Application**.
|
||||
- Fill in a **Twitch application name**.
|
||||
- Copy and paste the callback URL from your Nhost OAuth settings for Twitch to the input field under **OAuth Redirect URLs** and click **Add** to the right of the input field.
|
||||
- Select an application **Category**. E.g. _Application Integration_.
|
||||
- Click **Create**.
|
||||
|
||||
## Get Twitch Appplication Client ID and Client Secret
|
||||
|
||||
- Click on **Manage** on your newly created Twitch application.
|
||||
- Copy the **Client ID** and paste it into your Nhost OAuth settings for Twitch.
|
||||
- Click on **New Secret** to generate a new client secret.
|
||||
- Copy the **Client Secret** and paste it into your Nhost OAuth settings for Twitch.
|
||||
|
||||
## Sign In Users
|
||||
|
||||
Use the [Nhost JavaScript client](/reference/javascript) to sign in users in your app:
|
||||
|
||||
```js
|
||||
nhost.auth.signIn({
|
||||
provider: 'twitch'
|
||||
})
|
||||
```
|
||||
@@ -35,6 +35,18 @@ nhost.auth.signIn({
|
||||
|
||||
Users are redirected to your Nhost app's **client URL** by default. By default, your Nhost app's client URL is set to `http://localhost:3000`. You can change the value of your client URL in the Nhost console by going to **Users** → **Authentication Settings** → **Client URL**.
|
||||
|
||||
|
||||
Here is an example of how to redirect to another host or path:
|
||||
|
||||
```js
|
||||
nhost.auth.signIn({
|
||||
provider: '<provider>'
|
||||
options: {
|
||||
redirectTo: "<host>/<slug>" // Example: "https://example.com/dashboard"
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
## Provider OAuth scopes
|
||||
|
||||
Scopes are a mechanism in OAuth to allow or limit an application's access to a user's account.
|
||||
|
||||
@@ -81,6 +81,18 @@ nhost up
|
||||
|
||||
Hasura Console starts automatically and your Nhost app is running locally with the backend URL: `http://localhost:1337`.
|
||||
|
||||
## Subdomain and Region
|
||||
|
||||
Use `localhost:1337` as the `subdomain`, and skip `region` when using the CLI and the [JavaScript SDK](/reference/javascript):
|
||||
|
||||
```
|
||||
import { NhostClient } from '@nhost/nhost-js'
|
||||
|
||||
const nhost = new NhostClient({
|
||||
subdomain: 'localhost:1337',
|
||||
})
|
||||
```
|
||||
|
||||
## Emails
|
||||
|
||||
During local development with the CLI, all transactional emails from Authentication are sent to a local Mailhog instance, instead of to the recipient's email address. You'll see an address where after starting [`nhost up`](/reference/cli/up) where all emails are sent to.
|
||||
|
||||
@@ -21,10 +21,10 @@ The database is managed via the Hasura Console where you can manage the database
|
||||
|
||||
Hasura Console is where you manage your database. This is where you create and manage tables, schemas, and data.
|
||||
|
||||
1) Open the Hasura Console by clicking on **GraphQL** in the top menu in the Nhost Dashboard.
|
||||
2) Click **Open Hasura Console** at the top right of the page.
|
||||
3) Copy the **admin secret**, and click **Open Hasura**.
|
||||
4) Use the **admin secret** to sign in.
|
||||
1. Open the Hasura Console by clicking on **GraphQL** in the top menu in the Nhost Dashboard.
|
||||
2. Click **Open Hasura Console** at the top right of the page.
|
||||
3. Copy the **admin secret**, and click **Open Hasura**.
|
||||
4. Use the **admin secret** to sign in.
|
||||
|
||||
<video width="99%" autoPlay muted loop controls="true">
|
||||
<source src="/videos/open-hasura-console.mp4" type="video/mp4" />
|
||||
@@ -131,6 +131,21 @@ To track database changes, use the [Nhost CLI](/platform/cli) to develop locally
|
||||
|
||||
Learn how to [get started with Nhost CLI](/platform/overview/get-started-with-nhost-cli).
|
||||
|
||||
## Seed Data
|
||||
|
||||
Seed data is a way of automatically adding data to your database using SQL when a new environment is created. This is, for the moment, only applicable when you're using the [Nhost CLI](/platform/cli) to develop locally. When you're running `nhost up` for the first time, seed data is added.
|
||||
|
||||
In the future, seed data will also be added to new preview environments.
|
||||
|
||||
Seed data should be located in `nhost/seeds/default/` and are executed in alphabetical order.
|
||||
|
||||
**Example:** Two seed scripts with countries and products.
|
||||
|
||||
```text
|
||||
nhost/seeds/default/001-countries.sql
|
||||
nhost/seeds/default/002-products.sql
|
||||
```
|
||||
|
||||
## Backups
|
||||
|
||||
Databases on [Pro and Enterprise plans](https://nhost.io/pricing) are backed up automatically.
|
||||
|
||||
@@ -132,7 +132,8 @@ import { NhostNextProvider, NhostClient } from '@nhost/nextjs';
|
||||
|
||||
// highlight-start
|
||||
const nhost = new NhostClient({
|
||||
backendUrl: process.env.NEXT_PUBLIC_NHOST_BACKEND_URL || '',
|
||||
subdomain: process.env.NEXT_PUBLIC_NHOST_SUBDOMAIN || '',
|
||||
region: process.env.NEXT_PUBLIC_NHOST_REGION || ''
|
||||
});
|
||||
// highlight-end
|
||||
|
||||
@@ -149,16 +150,16 @@ function MyApp({ Component, pageProps }) {
|
||||
}
|
||||
```
|
||||
|
||||
Finally, make sure to create an environment variable named
|
||||
`NEXT_PUBLIC_NHOST_BACKEND_URL` to store your Nhost backend URL:
|
||||
Finally, store the environment variables for `subdomain` and `region` in `.env.development`:
|
||||
|
||||
```yaml title=".env.development"
|
||||
NEXT_PUBLIC_NHOST_BACKEND_URL=YOUR_NHOST_BACKEND_URL
|
||||
NEXT_PUBLIC_NHOST_SUBDOMAIN=YOUR_NHOST_APP_SUBDOMAIN
|
||||
NEXT_PUBLIC_NHOST_REGION=YOUR_NHOST_APP_REGION
|
||||
```
|
||||
|
||||
You can find your Nhost backend URL for your project from [your dashboard](https://app.nhost.io) as shown below:
|
||||
You find your Nhost app's subdomain and region in [the app dashboard](https://app.nhost.io):
|
||||
|
||||

|
||||

|
||||
|
||||
:::caution
|
||||
Don't forget to restart your Next.js server after saving your `.env.development`
|
||||
|
||||
@@ -128,7 +128,8 @@ Nhost backend:
|
||||
import { NhostClient, NhostReactProvider } from '@nhost/react'
|
||||
|
||||
const nhost = new NhostClient({
|
||||
backendUrl: process.env.REACT_APP_NHOST_BACKEND_URL || ''
|
||||
subdomain: process.env.REACT_APP_NHOST_SUBDOMAIN,
|
||||
region: process.env.REACT_APP_NHOST_REGION
|
||||
})
|
||||
|
||||
function App() {
|
||||
@@ -143,15 +144,16 @@ export default App
|
||||
```
|
||||
|
||||
Finally, make sure to create an environment variable named
|
||||
`REACT_APP_NHOST_BACKEND_URL` to store your Nhost backend URL:
|
||||
`REACT_APP_NHOST_SUBDOMAIN` and `REACT_APP_NHOST_REGION` to store your Nhost domain details:
|
||||
|
||||
```yaml title=".env.local"
|
||||
REACT_APP_NHOST_BACKEND_URL=YOUR_NHOST_BACKEND_URL
|
||||
REACT_APP_NHOST_SUBDOMAIN=YOUR_NHOST_APP_SUBDOMAIN
|
||||
REACT_APP_NHOST_REGION=YOUR_NHOST_APP_REGION
|
||||
```
|
||||
|
||||
You can find your Nhost backend URL for your project from [your dashboard](https://app.nhost.io) as shown below:
|
||||
You find your Nhost app's subdomain and region in [the app dashboard](https://app.nhost.io):
|
||||
|
||||

|
||||

|
||||
|
||||
:::caution
|
||||
Don't forget to restart your React server after saving your `.env.local`
|
||||
|
||||
@@ -136,7 +136,8 @@ import { NhostClient } from '@nhost/nhost-js'
|
||||
|
||||
// highlight-start
|
||||
const nhostClient = new NhostClient({
|
||||
backendUrl: process.env.NHOST_BACKEND_URL
|
||||
subdomain: process.env.NHOST_SUBDOMAIN
|
||||
region: process.env.NHOST_REGION
|
||||
})
|
||||
// highlight-end
|
||||
|
||||
@@ -175,16 +176,16 @@ const App = () => (
|
||||
|
||||
That prop avoids having an additional request to fetch the current user.
|
||||
|
||||
Next, make sure to create an environment variable named
|
||||
`NHOST_BACKEND_URL` to store your Nhost backend URL:
|
||||
Next, store the environment variables for `subdomain` and `region` in `.env`:
|
||||
|
||||
```yaml title=".env"
|
||||
NHOST_BACKEND_URL=YOUR_NHOST_BACKEND_URL
|
||||
NHOST_SUBDOMAIN=YOUR_NHOST_APP_SUBDOMAIN
|
||||
NHOST_REGION=YOUR_NHOST_APP_REGION
|
||||
```
|
||||
|
||||
You can find your Nhost backend URL for your project from [your dashboard](https://app.nhost.io) as shown below:
|
||||
You find your Nhost app's subdomain and region in [the app dashboard](https://app.nhost.io):
|
||||
|
||||

|
||||

|
||||
|
||||
Finally, we need to customize the GraphQL Endpoint for our RedwoodJS app. Indeed, by default, RedwoodJS provides a built-in GraphQL server under the `api` side. However, as we already have our own GraphQL server through Nhost and Hasura, we do not need it.
|
||||
|
||||
@@ -194,7 +195,7 @@ So, open the RedwoodJS configuration file, `redwood.toml`, and change the GraphQ
|
||||
[web]
|
||||
apiUrl = "/.redwood/functions"
|
||||
# highlight-next-line
|
||||
apiGraphQLUrl = "${NHOST_BACKEND_URL}/v1/graphql"
|
||||
apiGraphQLUrl = "https://${NHOST_SUBDOMAIN}.graphql.${NHOST_REGION}.nhost.run/v1"
|
||||
```
|
||||
|
||||
:::caution
|
||||
|
||||
@@ -153,7 +153,8 @@ import 'uno.css'
|
||||
|
||||
// highlight-start
|
||||
const nhost = new NhostClient({
|
||||
backendUrl: import.meta.env.VITE_NHOST_URL
|
||||
subdomain: import.meta.env.VITE_NHOST_SUBDOMAIN
|
||||
region: import.meta.env.VITE_NHOST_REGION
|
||||
})
|
||||
// highlight-end
|
||||
|
||||
@@ -170,16 +171,16 @@ app
|
||||
app.mount('#app')
|
||||
```
|
||||
|
||||
Finally, make sure to create an environment variable named
|
||||
`VITE_NHOST_URL` to store your Nhost backend URL:
|
||||
Finally, store the environment variables for `subdomain` and `region` in `.env`:
|
||||
|
||||
```bash title=".env"
|
||||
VITE_NHOST_URL=YOUR_NHOST_BACKEND_URL
|
||||
```yaml title=".env.development"
|
||||
VITE_NHOST_SUBDOMAIN=YOUR_NHOST_APP_SUBDOMAIN
|
||||
VITE_NHOST_REGION=YOUR_NHOST_APP_REGION
|
||||
```
|
||||
|
||||
You can find your Nhost backend URL for your project from [your dashboard](https://app.nhost.io) as shown below:
|
||||
You find your Nhost app's subdomain and region in [the app dashboard](https://app.nhost.io):
|
||||
|
||||

|
||||

|
||||
|
||||
## Build the app
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Launch the development environment for your app. Once the environment is up, the
|
||||
|
||||
- Apply database migrations.
|
||||
- Apply the Hasura metadata.
|
||||
- Apply seed data.
|
||||
- Apply [seed data](/platform/database#seed-data).
|
||||
|
||||
```bash
|
||||
nhost up
|
||||
|
||||
@@ -4,7 +4,7 @@ title: signUp()
|
||||
sidebar_label: signUp()
|
||||
slug: /reference/javascript/auth/sign-up
|
||||
description: Use `nhost.auth.signUp` to sign up a user using email and password. If you want to sign up a user using passwordless email (Magic Link), SMS, or an OAuth provider, use the `signIn` function instead.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L102
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L103
|
||||
---
|
||||
|
||||
# `signUp()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: signIn()
|
||||
sidebar_label: signIn()
|
||||
slug: /reference/javascript/auth/sign-in
|
||||
description: Use `nhost.auth.signIn` to sign in a user using email and password, passwordless (email or sms) or an external provider. `signIn` can be used to sign in a user in various ways depending on the parameters.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L145
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L146
|
||||
---
|
||||
|
||||
# `signIn()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: signOut()
|
||||
sidebar_label: signOut()
|
||||
slug: /reference/javascript/auth/sign-out
|
||||
description: Use `nhost.auth.signOut` to sign out the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L230
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L231
|
||||
---
|
||||
|
||||
# `signOut()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: resetPassword()
|
||||
sidebar_label: resetPassword()
|
||||
slug: /reference/javascript/auth/reset-password
|
||||
description: Use `nhost.auth.resetPassword` to reset the password for a user. This will send a reset-password link in an email to the user. When the user clicks the reset-password link the user is automatically signed-in. Once signed-in, the user can change their password using `nhost.auth.changePassword()`.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L246
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L247
|
||||
---
|
||||
|
||||
# `resetPassword()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: changePassword()
|
||||
sidebar_label: changePassword()
|
||||
slug: /reference/javascript/auth/change-password
|
||||
description: Use `nhost.auth.changePassword` to change the password for the user. The old password is not needed.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L262
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L263
|
||||
---
|
||||
|
||||
# `changePassword()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: sendVerificationEmail()
|
||||
sidebar_label: sendVerificationEmail()
|
||||
slug: /reference/javascript/auth/send-verification-email
|
||||
description: Use `nhost.auth.sendVerificationEmail` to send a verification email to the specified email. The email contains a verification-email link. When the user clicks the verification-email link their email is verified.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L278
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L279
|
||||
---
|
||||
|
||||
# `sendVerificationEmail()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: changeEmail()
|
||||
sidebar_label: changeEmail()
|
||||
slug: /reference/javascript/auth/change-email
|
||||
description: Use `nhost.auth.changeEmail` to change a user's email. This will send a confirm-email-change link in an email to the new email. Once the user clicks on the confirm-email-change link the email will be change to the new email.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L297
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L298
|
||||
---
|
||||
|
||||
# `changeEmail()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: deanonymize()
|
||||
sidebar_label: deanonymize()
|
||||
slug: /reference/javascript/auth/deanonymize
|
||||
description: Use `nhost.auth.deanonymize` to deanonymize a user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L313
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L314
|
||||
---
|
||||
|
||||
# `deanonymize()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: onTokenChanged()
|
||||
sidebar_label: onTokenChanged()
|
||||
slug: /reference/javascript/auth/on-token-changed
|
||||
description: Use `nhost.auth.onTokenChanged` to add a custom function that runs every time the access or refresh token is changed.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L356
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L357
|
||||
---
|
||||
|
||||
# `onTokenChanged()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: onAuthStateChanged()
|
||||
sidebar_label: onAuthStateChanged()
|
||||
slug: /reference/javascript/auth/on-auth-state-changed
|
||||
description: Use `nhost.auth.onAuthStateChanged` to add a custom function that runs every time the authentication status of the user changes. E.g. add a custom function that runs every time the authentication status changes from signed-in to signed-out.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L391
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L392
|
||||
---
|
||||
|
||||
# `onAuthStateChanged()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: isAuthenticated()
|
||||
sidebar_label: isAuthenticated()
|
||||
slug: /reference/javascript/auth/is-authenticated
|
||||
description: Use `nhost.auth.isAuthenticated` to check if the user is authenticated or not.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L433
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L434
|
||||
---
|
||||
|
||||
# `isAuthenticated()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: isAuthenticatedAsync()
|
||||
sidebar_label: isAuthenticatedAsync()
|
||||
slug: /reference/javascript/auth/is-authenticated-async
|
||||
description: Use `nhost.auth.isAuthenticatedAsync` to wait (await) for any internal authentication network requests to finish and then return the authentication status.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L451
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L452
|
||||
---
|
||||
|
||||
# `isAuthenticatedAsync()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getAuthenticationStatus()
|
||||
sidebar_label: getAuthenticationStatus()
|
||||
slug: /reference/javascript/auth/get-authentication-status
|
||||
description: Use `nhost.auth.getAuthenticationStatus` to get the authentication status of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L477
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L478
|
||||
---
|
||||
|
||||
# `getAuthenticationStatus()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getAccessToken()
|
||||
sidebar_label: getAccessToken()
|
||||
slug: /reference/javascript/auth/get-access-token
|
||||
description: Use `nhost.auth.getAccessToken` to get the access token of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L507
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L508
|
||||
---
|
||||
|
||||
# `getAccessToken()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getDecodedAccessToken()
|
||||
sidebar_label: getDecodedAccessToken()
|
||||
slug: /reference/javascript/auth/get-decoded-access-token
|
||||
description: Use `nhost.auth.getDecodedAccessToken` to get the decoded access token of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L522
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L523
|
||||
---
|
||||
|
||||
# `getDecodedAccessToken()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getHasuraClaims()
|
||||
sidebar_label: getHasuraClaims()
|
||||
slug: /reference/javascript/auth/get-hasura-claims
|
||||
description: Use `nhost.auth.getHasuraClaims` to get the Hasura claims of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L539
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L540
|
||||
---
|
||||
|
||||
# `getHasuraClaims()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getHasuraClaim()
|
||||
sidebar_label: getHasuraClaim()
|
||||
slug: /reference/javascript/auth/get-hasura-claim
|
||||
description: Use `nhost.auth.getHasuraClaim` to get the value of a specific Hasura claim of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L557
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L558
|
||||
---
|
||||
|
||||
# `getHasuraClaim()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: refreshSession()
|
||||
sidebar_label: refreshSession()
|
||||
slug: /reference/javascript/auth/refresh-session
|
||||
description: Use `nhost.auth.refreshSession` to refresh the session with either the current internal refresh token or an external refresh token.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L580
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L581
|
||||
---
|
||||
|
||||
# `refreshSession()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getSession()
|
||||
sidebar_label: getSession()
|
||||
slug: /reference/javascript/auth/get-session
|
||||
description: Use `nhost.auth.getSession()` to get the session of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L624
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L625
|
||||
---
|
||||
|
||||
# `getSession()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getUser()
|
||||
sidebar_label: getUser()
|
||||
slug: /reference/javascript/auth/get-user
|
||||
description: Use `nhost.auth.getUser()` to get the signed-in user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L639
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L640
|
||||
---
|
||||
|
||||
# `getUser()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: NhostClient
|
||||
sidebar_label: NhostClient
|
||||
description: No description provided.
|
||||
slug: /reference/javascript/nhost-js/nhost-client
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/core/nhost-client.ts#L9
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/core/nhost-client.ts#L8
|
||||
---
|
||||
|
||||
# `NhostClient`
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: createFileUploadMachine()
|
||||
sidebar_label: createFileUploadMachine()
|
||||
slug: /reference/javascript/storage/create-file-upload-machine
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/file-upload.ts#L36
|
||||
---
|
||||
|
||||
# `createFileUploadMachine()`
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: createMultipleFilesUploadMachine()
|
||||
sidebar_label: createMultipleFilesUploadMachine()
|
||||
slug: /reference/javascript/storage/create-multiple-files-upload-machine
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L37
|
||||
---
|
||||
|
||||
# `createMultipleFilesUploadMachine()`
|
||||
@@ -4,7 +4,7 @@ title: upload()
|
||||
sidebar_label: upload()
|
||||
slug: /reference/javascript/storage/upload
|
||||
description: Use `nhost.storage.upload` to upload a file. The `file` must be of type [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L52
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L52
|
||||
---
|
||||
|
||||
# `upload()`
|
||||
|
||||
@@ -5,7 +5,7 @@ sidebar_label: getUrl()
|
||||
slug: /reference/javascript/storage/get-url
|
||||
sidebar_class_name: deprecated
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L74
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L74
|
||||
---
|
||||
|
||||
# `getUrl()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getPublicUrl()
|
||||
sidebar_label: getPublicUrl()
|
||||
slug: /reference/javascript/storage/get-public-url
|
||||
description: Use `nhost.storage.getPublicUrl` to get the public URL of a file. The public URL can be used for un-authenticated users to access files. To access public files the `public` role must have permissions to select the file in the `storage.files` table.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L88
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L88
|
||||
---
|
||||
|
||||
# `getPublicUrl()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getPresignedUrl()
|
||||
sidebar_label: getPresignedUrl()
|
||||
slug: /reference/javascript/storage/get-presigned-url
|
||||
description: Use `nhost.storage.getPresignedUrl` to get a presigned URL of a file. To get a presigned URL the user must have permission to select the file in the `storage.files` table.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L110
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L110
|
||||
---
|
||||
|
||||
# `getPresignedUrl()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: delete()
|
||||
sidebar_label: delete()
|
||||
slug: /reference/javascript/storage/delete
|
||||
description: Use `nhost.storage.delete` to delete a file. To delete a file the user must have permissions to delete the file in the `storage.files` table. Deleting the file using `nhost.storage.delete()` will delete both the file and its metadata.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L135
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L135
|
||||
---
|
||||
|
||||
# `delete()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: setAccessToken()
|
||||
sidebar_label: setAccessToken()
|
||||
slug: /reference/javascript/storage/set-access-token
|
||||
description: Use `nhost.storage.setAccessToken` to a set an access token to be used in subsequent storage requests. Note that if you're signin in users with `nhost.auth.signIn()` the access token will be set automatically.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L156
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L156
|
||||
---
|
||||
|
||||
# `setAccessToken()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: setAdminSecret()
|
||||
sidebar_label: setAdminSecret()
|
||||
slug: /reference/javascript/storage/set-admin-secret
|
||||
description: Use `nhost.storage.adminSecret` to set the admin secret to be used for subsequent storage requests. This is useful if you want to run storage in "admin mode".
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L174
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L174
|
||||
---
|
||||
|
||||
# `setAdminSecret()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: HasuraStorageClient
|
||||
sidebar_label: Storage
|
||||
description: No description provided.
|
||||
slug: /reference/javascript/storage
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L25
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L25
|
||||
---
|
||||
|
||||
# `HasuraStorageClient`
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: uploadFilePromise()
|
||||
sidebar_label: uploadFilePromise()
|
||||
slug: /reference/javascript/storage/upload-file-promise
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/file-upload.ts#L40
|
||||
---
|
||||
|
||||
# `uploadFilePromise()`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">nhost</span>** <span className="optional-status">required</span> [`NhostClientReturnType`](/reference/docgen/javascript/storage/types/nhost-client-return-type)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :-------------------------------------------------------------------------------------------- | :----------------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>storage</span> | `{ url: string }` | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>auth</span> | `HasuraAuthClient` | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>adminSecret</span> | `string` | | |
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">interpreter</span>** <span className="optional-status">required</span> `ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>` | `Interpreter<FileUploadContext, any, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> `Partial<StorageUploadParams>`
|
||||
|
||||
---
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: uploadMultipleFilesPromise()
|
||||
sidebar_label: uploadMultipleFilesPromise()
|
||||
slug: /reference/javascript/storage/upload-multiple-files-promise
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/multiple-files-upload.ts#L46
|
||||
---
|
||||
|
||||
# `uploadMultipleFilesPromise()`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">nhost</span>** <span className="optional-status">required</span> [`NhostClientReturnType`](/reference/docgen/javascript/storage/types/nhost-client-return-type)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :-------------------------------------------------------------------------------------------- | :----------------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>auth</span> | `HasuraAuthClient` | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>storage</span> | `{ url: string }` | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>adminSecret</span> | `string` | | |
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">service</span>** <span className="optional-status">required</span> `Interpreter<MultipleFilesUploadContext, any, { type: "ADD", files: AnyFileList, bucketId: string } | { type: "UPLOAD", url: string, files: AnyFileList, bucketId: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", additions: number } | { type: "UPLOAD_DONE" } | { type: "UPLOAD_ERROR" } | { type: "CANCEL" } | { type: "REMOVE" } | { type: "CLEAR" }, { value: any, context: MultipleFilesUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", files: AnyFileList, bucketId: string } | { type: "UPLOAD", url: string, files: AnyFileList, bucketId: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", additions: number } | { type: "UPLOAD_DONE" } | { type: "UPLOAD_ERROR" } | { type: "CANCEL" } | { type: "REMOVE" } | { type: "CLEAR" }, BaseActionObject, ServiceMap>>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">optional</span> [`UploadMultipleFilesActionParams`](/reference/docgen/javascript/storage/types/upload-multiple-files-action-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------ | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>bucketId</span> | `string` | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>files</span> | [`AnyFileList`](/reference/docgen/javascript/storage/types/any-file-list) | | |
|
||||
|
||||
---
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: AnyFileList
|
||||
sidebar_label: AnyFileList
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L9
|
||||
---
|
||||
|
||||
# `AnyFileList`
|
||||
|
||||
```ts
|
||||
type AnyFileList = File | Array<File> | FileList
|
||||
```
|
||||
@@ -4,7 +4,7 @@ title: ApiDeleteParams
|
||||
sidebar_label: ApiDeleteParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L61
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L69
|
||||
---
|
||||
|
||||
# `ApiDeleteParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiDeleteResponse
|
||||
sidebar_label: ApiDeleteResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L65
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L73
|
||||
---
|
||||
|
||||
# `ApiDeleteResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiGetPresignedUrlParams
|
||||
sidebar_label: ApiGetPresignedUrlParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L53
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L61
|
||||
---
|
||||
|
||||
# `ApiGetPresignedUrlParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiGetPresignedUrlResponse
|
||||
sidebar_label: ApiGetPresignedUrlResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L57
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L65
|
||||
---
|
||||
|
||||
# `ApiGetPresignedUrlResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiUploadParams
|
||||
sidebar_label: ApiUploadParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L42
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L50
|
||||
---
|
||||
|
||||
# `ApiUploadParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiUploadResponse
|
||||
sidebar_label: ApiUploadResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L49
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L57
|
||||
---
|
||||
|
||||
# `ApiUploadResponse`
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileItemRef
|
||||
sidebar_label: FileItemRef
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L7
|
||||
---
|
||||
|
||||
# `FileItemRef`
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadContext
|
||||
sidebar_label: FileUploadContext
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/file-upload.ts#L6
|
||||
---
|
||||
|
||||
# `FileUploadContext`
|
||||
|
||||
```ts
|
||||
type FileUploadContext = () => {
|
||||
progress: number | null
|
||||
loaded: number
|
||||
error: ErrorPayload | null
|
||||
id: string
|
||||
bucketId: string
|
||||
file: File
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadEvents
|
||||
sidebar_label: FileUploadEvents
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/file-upload.ts#L15
|
||||
---
|
||||
|
||||
# `FileUploadEvents`
|
||||
|
||||
```ts
|
||||
type FileUploadEvents =
|
||||
| { type: 'ADD'; file: File; id: string; bucketId: string; name: string }
|
||||
| {
|
||||
type: 'UPLOAD'
|
||||
url: string
|
||||
file: File
|
||||
id: string
|
||||
bucketId: string
|
||||
name: string
|
||||
accessToken: string
|
||||
adminSecret: string
|
||||
}
|
||||
| {
|
||||
type: 'UPLOAD_PROGRESS'
|
||||
progress: number
|
||||
loaded: number
|
||||
additions: number
|
||||
}
|
||||
| { type: 'UPLOAD_DONE'; id: string; bucketId: string }
|
||||
| { type: 'UPLOAD_ERROR'; error: ErrorPayload }
|
||||
| { type: 'CANCEL' }
|
||||
| { type: 'DESTROY' }
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadMachine
|
||||
sidebar_label: FileUploadMachine
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/file-upload.ts#L35
|
||||
---
|
||||
|
||||
# `FileUploadMachine`
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadState
|
||||
sidebar_label: FileUploadState
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/file-upload.ts#L38
|
||||
---
|
||||
|
||||
# `FileUploadState`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file is being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file has been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">id</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the id of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">bucketId</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the bucket id.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">name</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the name of the file.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesHandlerResult
|
||||
sidebar_label: MultipleFilesHandlerResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/multiple-files-upload.ts#L17
|
||||
---
|
||||
|
||||
# `MultipleFilesHandlerResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">files</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
The list of file uploads. The properties can be accessed through `item.getSnapshot()` of with the `useFileUploadItem` hook.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all upload request are processed, but at least one of them has failed.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">errors</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
Returns the list of file uploads that have failed
|
||||
|
||||
---
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesUploadContext
|
||||
sidebar_label: MultipleFilesUploadContext
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L11
|
||||
---
|
||||
|
||||
# `MultipleFilesUploadContext`
|
||||
|
||||
```ts
|
||||
type MultipleFilesUploadContext = () => { progress: number | null, files: Array<[FileItemRef](/reference/docgen/javascript/storage/types/file-item-ref)>, loaded: number, total: number }
|
||||
```
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesUploadEvents
|
||||
sidebar_label: MultipleFilesUploadEvents
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L18
|
||||
---
|
||||
|
||||
# `MultipleFilesUploadEvents`
|
||||
|
||||
```ts
|
||||
type MultipleFilesUploadEvents =
|
||||
| { type: 'ADD'; files: AnyFileList; bucketId: string }
|
||||
| {
|
||||
type: 'UPLOAD'
|
||||
url: string
|
||||
files: AnyFileList
|
||||
bucketId: string
|
||||
accessToken: string
|
||||
adminSecret: string
|
||||
}
|
||||
| { type: 'UPLOAD_PROGRESS'; additions: number }
|
||||
| { type: 'UPLOAD_DONE' }
|
||||
| { type: 'UPLOAD_ERROR' }
|
||||
| { type: 'CANCEL' }
|
||||
| { type: 'REMOVE' }
|
||||
| { type: 'CLEAR' }
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesUploadMachine
|
||||
sidebar_label: MultipleFilesUploadMachine
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L35
|
||||
---
|
||||
|
||||
# `MultipleFilesUploadMachine`
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesUploadState
|
||||
sidebar_label: MultipleFilesUploadState
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/multiple-files-upload.ts#L32
|
||||
---
|
||||
|
||||
# `MultipleFilesUploadState`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the files are being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the overall progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">files</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
The list of file uploads. The properties can be accessed through `item.getSnapshot()` of with the `useFileUploadItem` hook.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all upload request are processed, but at least one of them has failed.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">errors</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
Returns the list of file uploads that have failed
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all the files have been successfully uploaded.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleUploadProgressState
|
||||
sidebar_label: MultipleUploadProgressState
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/multiple-files-upload.ts#L6
|
||||
---
|
||||
|
||||
# `MultipleUploadProgressState`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the files are being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the overall progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: NhostClientReturnType
|
||||
sidebar_label: NhostClientReturnType
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L4
|
||||
---
|
||||
|
||||
# `NhostClientReturnType`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">auth</span>** <span className="optional-status">required</span> `HasuraAuthClient`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">storage</span>** <span className="optional-status">required</span> `{ url: string }`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">adminSecret</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
---
|
||||
@@ -4,7 +4,7 @@ title: StorageDeleteParams
|
||||
sidebar_label: StorageDeleteParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L24
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L32
|
||||
---
|
||||
|
||||
# `StorageDeleteParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageDeleteResponse
|
||||
sidebar_label: StorageDeleteResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L28
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L36
|
||||
---
|
||||
|
||||
# `StorageDeleteResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageGetPresignedUrlParams
|
||||
sidebar_label: StorageGetPresignedUrlParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L16
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L24
|
||||
---
|
||||
|
||||
# `StorageGetPresignedUrlParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageGetPresignedUrlResponse
|
||||
sidebar_label: StorageGetPresignedUrlResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L20
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L28
|
||||
---
|
||||
|
||||
# `StorageGetPresignedUrlResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageGetUrlParams
|
||||
sidebar_label: StorageGetUrlParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L12
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L20
|
||||
---
|
||||
|
||||
# `StorageGetUrlParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageUploadParams
|
||||
sidebar_label: StorageUploadParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L1
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L9
|
||||
---
|
||||
|
||||
# `StorageUploadParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageUploadResponse
|
||||
sidebar_label: StorageUploadResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L8
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L16
|
||||
---
|
||||
|
||||
# `StorageUploadResponse`
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: UploadFileHandlerResult
|
||||
sidebar_label: UploadFileHandlerResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/file-upload.ts#L19
|
||||
---
|
||||
|
||||
# `UploadFileHandlerResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file has been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">id</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the id of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">bucketId</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the bucket id.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">name</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the name of the file.
|
||||
|
||||
---
|
||||
@@ -4,7 +4,7 @@ title: UploadHeaders
|
||||
sidebar_label: UploadHeaders
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L69
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L77
|
||||
---
|
||||
|
||||
# `UploadHeaders`
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: UploadMultipleFilesActionParams
|
||||
sidebar_label: UploadMultipleFilesActionParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/multiple-files-upload.ts#L41
|
||||
---
|
||||
|
||||
# `UploadMultipleFilesActionParams`
|
||||
|
||||
```ts
|
||||
type UploadMultipleFilesActionParams = () => { bucketId: string, files: [AnyFileList](/reference/docgen/javascript/storage/types/any-file-list) }
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: UploadProgressState
|
||||
sidebar_label: UploadProgressState
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/file-upload.ts#L8
|
||||
---
|
||||
|
||||
# `UploadProgressState`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file is being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useFileUploadItem()
|
||||
sidebar_label: useFileUploadItem()
|
||||
slug: /reference/nextjs/use-file-upload-item
|
||||
description: Use the hook `useFileUploadItem` to control the file upload of a file in a multiple file upload.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L61
|
||||
---
|
||||
|
||||
# `useFileUploadItem()`
|
||||
|
||||
Use the hook `useFileUploadItem` to control the file upload of a file in a multiple file upload.
|
||||
|
||||
It has the same signature as `useFileUpload`.
|
||||
|
||||
```tsx
|
||||
const Item = ({ itemRef }) => {
|
||||
const { name, progress } = useFileUploadItem(itemRef)
|
||||
return (
|
||||
<li>
|
||||
{name} {progress}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
const List = () => {
|
||||
const { list } = useMultipleFilesUpload()
|
||||
return (
|
||||
<ul>
|
||||
{list.map((itemRef) => (
|
||||
<Item key={item.id} itemRef={item} />
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">ref</span>** <span className="optional-status">required</span> `ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>` | `Interpreter<FileUploadContext, any, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>`
|
||||
|
||||
---
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useFileUpload()
|
||||
sidebar_label: useFileUpload()
|
||||
slug: /reference/nextjs/use-file-upload
|
||||
description: Use the hook `useFileUpload` to upload a file.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L142
|
||||
---
|
||||
|
||||
# `useFileUpload()`
|
||||
|
||||
Use the hook `useFileUpload` to upload a file.
|
||||
|
||||
```tsx
|
||||
const {
|
||||
add,
|
||||
upload,
|
||||
cancel,
|
||||
isUploaded,
|
||||
isUploading,
|
||||
isError,
|
||||
progress,
|
||||
id,
|
||||
bucketId,
|
||||
name
|
||||
} = useFileUpload()
|
||||
|
||||
const handleFormSubmit = async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
await upload({ file })
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useMultipleFilesUpload()
|
||||
sidebar_label: useMultipleFilesUpload()
|
||||
slug: /reference/nextjs/use-multiple-files-upload
|
||||
description: Use the hook `useFileUpload` to upload multiple files.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useMultipleFilesUpload.ts#L55
|
||||
---
|
||||
|
||||
# `useMultipleFilesUpload()`
|
||||
|
||||
Use the hook `useFileUpload` to upload multiple files.
|
||||
@@ -3,13 +3,17 @@
|
||||
title: useNhostBackendUrl()
|
||||
sidebar_label: useNhostBackendUrl()
|
||||
slug: /reference/nextjs/use-nhost-backend-url
|
||||
description: Use the hook `useNhostBackendUrl` to get the Nhost backend URL.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useNhostBackendUrl.ts#L15
|
||||
sidebar_class_name: deprecated
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useNhostBackendUrl.ts#L16
|
||||
---
|
||||
|
||||
# `useNhostBackendUrl()`
|
||||
|
||||
:::caution Deprecated
|
||||
Nhost services can now be split to subdomains to improve performance with CDN. Use `nhost.auth.url` or `nhost.storage.url` instead.
|
||||
Use the hook `useNhostBackendUrl` to get the Nhost backend URL.
|
||||
:::
|
||||
|
||||
```tsx
|
||||
const nhostBackendUrl = useNhostBackendUrl()
|
||||
|
||||
10
docs/docs/reference/docgen/nextjs/types/file-item-ref.mdx
Normal file
10
docs/docs/reference/docgen/nextjs/types/file-item-ref.mdx
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileItemRef
|
||||
sidebar_label: FileItemRef
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L7
|
||||
---
|
||||
|
||||
# `FileItemRef`
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadHookResult
|
||||
sidebar_label: FileUploadHookResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L16
|
||||
---
|
||||
|
||||
# `FileUploadHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file is being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file has been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">id</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the id of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">bucketId</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the bucket id.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">name</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the name of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">add</span>** <span className="optional-status">required</span> `(params: StorageUploadParams) => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">upload</span>** <span className="optional-status">required</span> `(params: Partial<StorageUploadParams>) => Promise<UploadFileHandlerResult>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">cancel</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesHookResult
|
||||
sidebar_label: MultipleFilesHookResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useMultipleFilesUpload.ts#L15
|
||||
---
|
||||
|
||||
# `MultipleFilesHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the files are being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the overall progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">files</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
The list of file uploads. The properties can be accessed through `item.getSnapshot()` of with the `useFileUploadItem` hook.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all upload request are processed, but at least one of them has failed.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">errors</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
Returns the list of file uploads that have failed
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all the files have been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">add</span>** <span className="optional-status">required</span> `(params: Required<Pick<UploadMultipleFilesActionParams, "files">> & UploadMultipleFilesActionParams) => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">upload</span>** <span className="optional-status">required</span> `(params: UploadMultipleFilesActionParams) => Promise<MultipleFilesHandlerResult>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">cancel</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">clear</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useFileUploadItem()
|
||||
sidebar_label: useFileUploadItem()
|
||||
slug: /reference/react/use-file-upload-item
|
||||
description: Use the hook `useFileUploadItem` to control the file upload of a file in a multiple file upload.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L61
|
||||
---
|
||||
|
||||
# `useFileUploadItem()`
|
||||
|
||||
Use the hook `useFileUploadItem` to control the file upload of a file in a multiple file upload.
|
||||
|
||||
It has the same signature as `useFileUpload`.
|
||||
|
||||
```tsx
|
||||
const Item = ({ itemRef }) => {
|
||||
const { name, progress } = useFileUploadItem(itemRef)
|
||||
return (
|
||||
<li>
|
||||
{name} {progress}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
const List = () => {
|
||||
const { list } = useMultipleFilesUpload()
|
||||
return (
|
||||
<ul>
|
||||
{list.map((itemRef) => (
|
||||
<Item key={item.id} itemRef={item} />
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">ref</span>** <span className="optional-status">required</span> `ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>` | `Interpreter<FileUploadContext, any, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>`
|
||||
|
||||
---
|
||||
33
docs/docs/reference/docgen/react/content/use-file-upload.mdx
Normal file
33
docs/docs/reference/docgen/react/content/use-file-upload.mdx
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useFileUpload()
|
||||
sidebar_label: useFileUpload()
|
||||
slug: /reference/react/use-file-upload
|
||||
description: Use the hook `useFileUpload` to upload a file.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L142
|
||||
---
|
||||
|
||||
# `useFileUpload()`
|
||||
|
||||
Use the hook `useFileUpload` to upload a file.
|
||||
|
||||
```tsx
|
||||
const {
|
||||
add,
|
||||
upload,
|
||||
cancel,
|
||||
isUploaded,
|
||||
isUploading,
|
||||
isError,
|
||||
progress,
|
||||
id,
|
||||
bucketId,
|
||||
name
|
||||
} = useFileUpload()
|
||||
|
||||
const handleFormSubmit = async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
await upload({ file })
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useMultipleFilesUpload()
|
||||
sidebar_label: useMultipleFilesUpload()
|
||||
slug: /reference/react/use-multiple-files-upload
|
||||
description: Use the hook `useFileUpload` to upload multiple files.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useMultipleFilesUpload.ts#L55
|
||||
---
|
||||
|
||||
# `useMultipleFilesUpload()`
|
||||
|
||||
Use the hook `useFileUpload` to upload multiple files.
|
||||
@@ -3,13 +3,17 @@
|
||||
title: useNhostBackendUrl()
|
||||
sidebar_label: useNhostBackendUrl()
|
||||
slug: /reference/react/use-nhost-backend-url
|
||||
description: Use the hook `useNhostBackendUrl` to get the Nhost backend URL.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useNhostBackendUrl.ts#L15
|
||||
sidebar_class_name: deprecated
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useNhostBackendUrl.ts#L16
|
||||
---
|
||||
|
||||
# `useNhostBackendUrl()`
|
||||
|
||||
:::caution Deprecated
|
||||
Nhost services can now be split to subdomains to improve performance with CDN. Use `nhost.auth.url` or `nhost.storage.url` instead.
|
||||
Use the hook `useNhostBackendUrl` to get the Nhost backend URL.
|
||||
:::
|
||||
|
||||
```tsx
|
||||
const nhostBackendUrl = useNhostBackendUrl()
|
||||
|
||||
10
docs/docs/reference/docgen/react/types/file-item-ref.mdx
Normal file
10
docs/docs/reference/docgen/react/types/file-item-ref.mdx
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileItemRef
|
||||
sidebar_label: FileItemRef
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L7
|
||||
---
|
||||
|
||||
# `FileItemRef`
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadHookResult
|
||||
sidebar_label: FileUploadHookResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L16
|
||||
---
|
||||
|
||||
# `FileUploadHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file is being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file has been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">id</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the id of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">bucketId</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the bucket id.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">name</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the name of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">add</span>** <span className="optional-status">required</span> `(params: StorageUploadParams) => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">upload</span>** <span className="optional-status">required</span> `(params: Partial<StorageUploadParams>) => Promise<UploadFileHandlerResult>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">cancel</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesHookResult
|
||||
sidebar_label: MultipleFilesHookResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useMultipleFilesUpload.ts#L15
|
||||
---
|
||||
|
||||
# `MultipleFilesHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the files are being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the overall progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">files</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
The list of file uploads. The properties can be accessed through `item.getSnapshot()` of with the `useFileUploadItem` hook.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all upload request are processed, but at least one of them has failed.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">errors</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
Returns the list of file uploads that have failed
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all the files have been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">add</span>** <span className="optional-status">required</span> `(params: Required<Pick<UploadMultipleFilesActionParams, "files">> & UploadMultipleFilesActionParams) => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">upload</span>** <span className="optional-status">required</span> `(params: UploadMultipleFilesActionParams) => Promise<MultipleFilesHandlerResult>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">cancel</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">clear</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
@@ -39,7 +39,8 @@ import { NhostApolloProvider } from '@nhost/react-apollo'
|
||||
import { NhostClient, NhostReactProvider } from '@nhost/react'
|
||||
|
||||
const nhost = new NhostClient({
|
||||
backendUrl: '<Your Nhost Backend URL>'
|
||||
subdomain: '<app-subdomain>',
|
||||
region: '<app-region>'
|
||||
})
|
||||
|
||||
ReactDOM.render(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user