Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.

Commit ea16040

Browse files
authored
feat (packages/nhost-js): graphql.post -> graphql.request (#41)
1 parent dd866fb commit ea16040

21 files changed

Lines changed: 43 additions & 37 deletions

File tree

demos/ReactNativeDemo/app/profile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function Profile() {
2929

3030
try {
3131
// Correctly structure GraphQL query with parameters
32-
const response = await nhost.graphql.post<MfaStatusResponse>({
32+
const response = await nhost.graphql.request<MfaStatusResponse>({
3333
query: `
3434
query GetUserMfaStatus($userId: uuid!) {
3535
user(id: $userId) {

demos/ReactNativeDemo/app/upload.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default function Upload() {
4747

4848
try {
4949
// Fetch files using GraphQL query
50-
const response = await nhost.graphql.post<GraphqlGetFilesResponse>({
50+
const response = await nhost.graphql.request<GraphqlGetFilesResponse>({
5151
query: `query GetFiles {
5252
files {
5353
id

demos/express/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ app.post("/cookies", async (req: Request, res: Response) => {
7373
const nhost = nhostClientFromCookies(req);
7474

7575
try {
76-
const response = await nhost.graphql.post<GraphqlGetFilesResponse>({
76+
const response = await nhost.graphql.request<GraphqlGetFilesResponse>({
7777
query: `query GetFiles {
7878
files {
7979
id
@@ -99,7 +99,7 @@ app.post("/cookies", async (req: Request, res: Response) => {
9999
app.post("/auth-header", async (req: Request, res: Response) => {
100100
const nhost = nhostClientFromAuthHeader(req);
101101
try {
102-
const response = await nhost.graphql.post<GraphqlGetFilesResponse>({
102+
const response = await nhost.graphql.request<GraphqlGetFilesResponse>({
103103
query: `query GetFiles {
104104
files {
105105
id

demos/nextjs-ssr-demo/src/app/components/SecurityKeyClient.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function SecurityKeyClient({
5252

5353
try {
5454
// Send request to server to delete the security key
55-
await nhost.graphql.post({
55+
await nhost.graphql.request({
5656
query: `
5757
mutation DeleteSecurityKey($keyId: uuid!) {
5858
deleteAuthUserSecurityKey(id: $keyId) {

demos/nextjs-ssr-demo/src/app/profile/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default async function Profile() {
1919

2020
if (session?.user?.id) {
2121
try {
22-
const response = await nhost.graphql.post<GetUserMfaStatusResponse>({
22+
const response = await nhost.graphql.request<GetUserMfaStatusResponse>({
2323
query: `
2424
query GetUserMfaStatus($userId: uuid!) {
2525
user(id: $userId) {

demos/nextjs-ssr-demo/src/app/profile/security-keys.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default async function SecurityKeys() {
4040

4141
try {
4242
// Server-side fetch of security keys
43-
const response = await nhost.graphql.post<SecurityKeysData>({
43+
const response = await nhost.graphql.request<SecurityKeysData>({
4444
query: `
4545
query GetUserSecurityKeys($userId: uuid!) {
4646
user(id: $userId) {

demos/nextjs-ssr-demo/src/app/upload/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default async function UploadPage() {
1515
let error: string | null = null;
1616

1717
try {
18-
const response = await nhost.graphql.post<GetFilesResponse>({
18+
const response = await nhost.graphql.request<GetFilesResponse>({
1919
query: `
2020
query GetFiles {
2121
files {

demos/react-demo/src/components/SecurityKeys.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function SecurityKeys() {
5555
try {
5656
// Query the database for all security keys registered to this user
5757
const response: FetchResponse<SecurityKeysResponse> =
58-
await nhost.graphql.post({
58+
await nhost.graphql.request({
5959
query: `
6060
query GetUserSecurityKeys($userId: uuid!) {
6161
user(id: $userId) {
@@ -95,7 +95,7 @@ export default function SecurityKeys() {
9595
// Send request to server to delete the security key
9696
// This removes the stored public key from the server database
9797
// so it can no longer be used for authentication
98-
const response = await nhost.graphql.post({
98+
const response = await nhost.graphql.request({
9999
query: `
100100
mutation DeleteSecurityKey($keyId: uuid!) {
101101
deleteAuthUserSecurityKey(id: $keyId) {

demos/react-demo/src/pages/Profile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function Profile(): JSX.Element {
2727
try {
2828
// Correctly structure GraphQL query with parameters
2929
const response: FetchResponse<MfaStatusResponse> =
30-
await nhost.graphql.post({
30+
await nhost.graphql.request({
3131
query: `
3232
query GetUserMfaStatus($userId: uuid!) {
3333
user(id: $userId) {

demos/react-demo/src/pages/Upload.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function Upload(): JSX.Element {
3232

3333
try {
3434
// Fetch files using GraphQL query
35-
const response = await nhost.graphql.post<GraphqlGetFilesResponse>({
35+
const response = await nhost.graphql.request<GraphqlGetFilesResponse>({
3636
query: `query GetFiles {
3737
files {
3838
id

0 commit comments

Comments
 (0)