about summary refs log tree commit diff
path: root/website/sandbox/contentful/src
diff options
context:
space:
mode:
Diffstat (limited to 'website/sandbox/contentful/src')
-rw-r--r--website/sandbox/contentful/src/App.tsx11
-rw-r--r--website/sandbox/contentful/src/contentful.ts10
-rw-r--r--website/sandbox/contentful/src/index.html4
-rw-r--r--website/sandbox/contentful/src/store.ts6
4 files changed, 18 insertions, 13 deletions
diff --git a/website/sandbox/contentful/src/App.tsx b/website/sandbox/contentful/src/App.tsx
index 6342bfc98dd6..288f03321804 100644
--- a/website/sandbox/contentful/src/App.tsx
+++ b/website/sandbox/contentful/src/App.tsx
@@ -8,7 +8,7 @@ import type { Book } from "./store";
 
 const App: React.FC = () => {
   const dispatch = useDispatch();
-  const { isLoading, books } = useTypedSelector(state => ({
+  const { isLoading, books } = useTypedSelector((state) => ({
     isLoading: state.isLoading,
     books: state.books,
   }));
@@ -16,7 +16,7 @@ const App: React.FC = () => {
   useEffect(() => {
     async function fetchData() {
       const entries = await getClient().getEntries();
-      const books = entries.items.map(x => x.fields) as Book[];
+      const books = entries.items.map((x) => x.fields) as Book[];
 
       dispatch(actions.setBooks(books));
     }
@@ -30,9 +30,12 @@ const App: React.FC = () => {
           <div className="container mx-auto">
             <h1 className="py-6 text-2xl">Books</h1>
             <ul>
-              {books.map(book => (
+              {books.map((book) => (
                 <li key={book.title} className="py-3">
-                  <p><span className="font-bold pr-3">{book.title}</span><span className="text-gray-600">{book.author}</span></p>
+                  <p>
+                    <span className="font-bold pr-3">{book.title}</span>
+                    <span className="text-gray-600">{book.author}</span>
+                  </p>
                 </li>
               ))}
             </ul>
diff --git a/website/sandbox/contentful/src/contentful.ts b/website/sandbox/contentful/src/contentful.ts
index e09cd8fc4ad3..02ebc92b68df 100644
--- a/website/sandbox/contentful/src/contentful.ts
+++ b/website/sandbox/contentful/src/contentful.ts
@@ -8,10 +8,10 @@ let client: ContentfulClientApi;
 
 // Idempotent way to get a reference to the Contentful client.
 export const getClient = (): ContentfulClientApi => {
-  if (typeof client !== 'undefined') {
+  if (typeof client !== "undefined") {
     return client;
   } else {
-    if (typeof space === 'string' && typeof accessToken === 'string') {
+    if (typeof space === "string" && typeof accessToken === "string") {
       let client = createClient({
         space,
         accessToken,
@@ -19,7 +19,9 @@ export const getClient = (): ContentfulClientApi => {
 
       return client;
     } else {
-      throw new Error('Please set CONTENTFUL_SPACE_ID and CONTENTFUL_ACCESS_TOKEN');
+      throw new Error(
+        "Please set CONTENTFUL_SPACE_ID and CONTENTFUL_ACCESS_TOKEN"
+      );
     }
   }
-}
+};
diff --git a/website/sandbox/contentful/src/index.html b/website/sandbox/contentful/src/index.html
index 05dd7ad95e79..91752af916a4 100644
--- a/website/sandbox/contentful/src/index.html
+++ b/website/sandbox/contentful/src/index.html
@@ -1,8 +1,8 @@
 <!DOCTYPE html>
 <html lang="en">
   <head>
-    <meta charset="UTF-8">
-    <link rel="stylesheet" href="./index.css">
+    <meta charset="UTF-8" />
+    <link rel="stylesheet" href="./index.css" />
   </head>
   <body>
     <div id="mount"></div>
diff --git a/website/sandbox/contentful/src/store.ts b/website/sandbox/contentful/src/store.ts
index c4396d681a17..b02053d302b6 100644
--- a/website/sandbox/contentful/src/store.ts
+++ b/website/sandbox/contentful/src/store.ts
@@ -22,9 +22,9 @@ export const { actions, reducer } = createSlice({
   name: "application",
   initialState,
   reducers: {
-    toggleIsLoading: state => ({ ...state, isLoading: !state.isLoading }),
-    setBooks: (state, action) => ({ ... state, books: action.payload }),
-  }
+    toggleIsLoading: (state) => ({ ...state, isLoading: !state.isLoading }),
+    setBooks: (state, action) => ({ ...state, books: action.payload }),
+  },
 });
 
 /**