Skip to content

Commit e26e37d

Browse files
committed
chore: double to single quotes
1 parent 1031da2 commit e26e37d

File tree

1 file changed

+15
-15
lines changed
  • src/pages/[platform]/build-a-backend/data/connect-event-api

1 file changed

+15
-15
lines changed

src/pages/[platform]/build-a-backend/data/connect-event-api/index.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,41 +41,41 @@ Before you begin, you will need:
4141
- Take note of: HTTP endpoint, region, API Key
4242

4343
```tsx title="src/App.tsx"
44-
import type { EventsChannel } from "aws-amplify/data";
45-
import { useState, useEffect, useRef } from "react";
46-
import { Amplify } from "aws-amplify";
47-
import { events } from "aws-amplify/data";
44+
import type { EventsChannel } from 'aws-amplify/data';
45+
import { useState, useEffect, useRef } from 'react';
46+
import { Amplify } from 'aws-amplify';
47+
import { events } from 'aws-amplify/data';
4848

4949
Amplify.configure({
5050
API: {
5151
Events: {
5252
endpoint:
53-
"https://abcdefghijklmnopqrstuvwxyz.appsync-api.us-east-1.amazonaws.com/event",
54-
region: "us-east-1",
55-
defaultAuthMode: "apiKey",
56-
apiKey: "da2-abcdefghijklmnopqrstuvwxyz",
53+
'https://abcdefghijklmnopqrstuvwxyz.appsync-api.us-east-1.amazonaws.com/event',
54+
region: 'us-east-1',
55+
defaultAuthMode: 'apiKey',
56+
apiKey: 'da2-abcdefghijklmnopqrstuvwxyz',
5757
},
5858
},
5959
});
6060

6161
export default function App() {
6262
const [myEvents, setMyEvents] = useState<unknown[]>([]);
6363

64-
const sub = useRef<ReturnType<EventsChannel["subscribe"]>>(null);
64+
const sub = useRef<ReturnType<EventsChannel['subscribe']>>(null);
6565

6666
useEffect(() => {
6767
let channel: EventsChannel;
6868

6969
const connectAndSubscribe = async () => {
70-
channel = await events.connect("default/channel");
70+
channel = await events.connect('default/channel');
7171

7272
if (!sub.current) {
7373
sub.current = channel.subscribe({
7474
next: (data) => {
75-
console.log("received", data);
75+
console.log('received', data);
7676
setMyEvents((prev) => [data, ...prev]);
7777
},
78-
error: (err) => console.error("error", err),
78+
error: (err) => console.error('error', err),
7979
});
8080
}
8181
};
@@ -91,11 +91,11 @@ export default function App() {
9191

9292
async function publishEvent() {
9393
// Publish via HTTP POST
94-
await events.post("default/channel", { some: "data" });
94+
await events.post('default/channel', { some: 'data' });
9595

9696
// Alternatively, publish events through the WebSocket channel
97-
const channel = await events.connect("default/channel");
98-
await channel.publish({ some: "data" });
97+
const channel = await events.connect('default/channel');
98+
await channel.publish({ some: 'data' });
9999
}
100100

101101
return (

0 commit comments

Comments
 (0)