Make it obvious when we talk about the Client SDKs

This commit is contained in:
Vincent (Wen Yu) Ge
2024-04-02 14:06:11 -04:00
parent b4eaca3570
commit 3fd85fa2ef
81 changed files with 719 additions and 740 deletions

View File

@@ -44,7 +44,7 @@ Create a new file `src/lib/appwrite.js` to hold our Appwrite related code.
Only one instance of the `Client()` class should be created per app.
Add the following code to it, replacing `<YOUR_PROJECT_ID>` with your project ID.
```js
```client-web
import { Client, Databases, Account } from "appwrite";
const client = new Client();

View File

@@ -12,7 +12,7 @@ We'll use context and a custom hook to manage our user's data.
Create a new file `src/lib/context/user.jsx` and add the following code to it.
```js
```client-web
import { ID } from "appwrite";
import { createContext, useContext, useEffect, useState } from "react";
import { account } from "../appwrite";
@@ -70,7 +70,7 @@ First, wrap the `main` element with the `UserProvider` component.
Update `src/App.jsx` to the following code.
```js
```client-web
import { Home } from "./pages/Home";
import { UserProvider } from "./lib/context/user";
@@ -93,7 +93,7 @@ Then, optionally render the `Login` component if the path is `/login`, otherwise
Update `src/App.jsx` to the following code.
```js
```client-web
import { Login } from "./pages/Login";
import { Home } from "./pages/Home";
import { UserProvider } from "./lib/context/user";
@@ -132,7 +132,7 @@ Finally, we are able to create the login page. Users will be able to login or re
Create a new file `src/pages/Login.jsx` and add the following code to it.
```js
```client-web
import { useState } from "react";
import { useUser } from "../lib/context/user";

View File

@@ -11,7 +11,7 @@ In our app we want to have a navigation bar that is always visible. We will add
Update the App componenent in `src/App.jsx`:
```js
```client-web
import { Login } from "./pages/Login";
import { Home } from "./pages/Home";
import { UserProvider, useUser } from "./lib/context/user";

View File

@@ -26,7 +26,7 @@ Create a new collection with the following attributes:
Now that you have a collection to hold ideas, we can read and write to it from our app. Like we did with the user data, we will create a React context to hold our ideas.
Create a new file `src/lib/context/ideas.jsx` and add the following code to it.
```js
```client-web
import { createContext, useContext, useEffect, useState } from "react";
import { databases } from "../appwrite";
import { ID, Query } from "appwrite";

View File

@@ -9,7 +9,7 @@ Using the `useIdeas` hook we can now display the ideas on the page. We will also
Overwrite the contents of `src/pages/Home.jsx` with the following:
```js
```client-web
import { useState } from "react";
import { useUser } from "../lib/context/user";
import { useIdeas } from "../lib/context/ideas";

View File

@@ -43,7 +43,7 @@ Create a new file `src/lib/appwrite.js` to hold our Appwrite related code.
Only one instance of the `Client()` class should be created per app.
Add the following code to it, replacing `<YOUR_PROJECT_ID>` with your project ID.
```js
```client-web
import { Client, Databases, Account } from "appwrite";
const client = new Client();

View File

@@ -12,7 +12,7 @@ We'll use a store to keep track of our user's data.
Create a new file `src/lib/user.js` and add the following code to it.
```js
```client-web
import { writable } from 'svelte/store';
import { ID } from 'appwrite';
import { goto } from '$app/navigation';

View File

@@ -33,7 +33,7 @@ Let's create some methods to manage ideas in our app.
Create a new file `src/lib/ideas.js` and add the following code:
```js
```client-web
import { ID, Query } from 'appwrite';
import { databases } from '$lib/appwrite';

View File

@@ -11,7 +11,7 @@ First, let's create a load function for our ideas page. This will load the lates
To do so, create a file called `src/routes/+page.js` with the following content:
```js
```client-web
import { getIdeas } from '$lib/ideas';
export async function load() {

View File

@@ -43,7 +43,7 @@ Create a new file `src/appwrite.js` to hold our Appwrite related code.
Only one instance of the `Client()` class should be created per app.
Add the following code to it, replacing `<YOUR_PROJECT_ID>` with your project ID.
```js
```client-web
import { Client, Databases, Account } from "appwrite";
const client = new Client();

View File

@@ -12,7 +12,7 @@ We'll create a store to share the user's data between components.
Create a new file `src/lib/stores/user.js` and add the following code to it.
```js
```client-web
import { ID } from "appwrite";
import { account } from "../appwrite";
import { reactive } from "vue";

View File

@@ -26,7 +26,7 @@ Create a new collection with the following attributes:
Now that you have a collection to hold ideas, we can read and write to it from our app. Like we did with the user data, we will create a store hold our ideas.
Create a new file `src/lib/stores/ideas.js` and add the following code to it.
```js
```client-web
import { ID, Query } from "appwrite";
import { databases } from "../appwrite";
import { reactive } from "vue";