Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 48dc8b4

Browse files
authoredJul 7, 2022
feat: update Appwrite to support 0.15.x (#41)
1 parent feadc4f commit 48dc8b4

File tree

6 files changed

+91
-31
lines changed

6 files changed

+91
-31
lines changed
 

‎.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
REACT_APP_ENDPOINT=
22
REACT_APP_PROJECT=
3-
REACT_APP_COLLECTION_ID=
3+
REACT_APP_COLLECTION_ID=
4+
REACT_APP_DATABASE_ID=

‎netlify.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
[template.environment]
1111
REACT_APP_ENDPOINT = "Your Appwrite Server Endpoint"
1212
REACT_APP_PROJECT = "Your Appwrite project ID"
13-
REACT_APP_COLLECTION_ID = "Your Collection ID"
13+
REACT_APP_COLLECTION_ID = "Your Collection ID"
14+
REACT_APP_DATABASE_ID = "Your Database ID"

‎package-lock.json

Lines changed: 77 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"dependencies": {
66
"@craco/craco": "^6.1.1",
7-
"appwrite": "^6.0.1",
7+
"appwrite": "^9.0.0",
88
"react": "^17.0.2",
99
"react-dom": "^17.0.2",
1010
"react-router-dom": "^5.2.0",

‎src/api/api.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Appwrite } from "appwrite";
2-
import { Server } from "../utils/config";
1+
import { Client as Appwrite, Databases, Account } from 'appwrite';
2+
import { Server } from '../utils/config';
33

44
let api = {
55
sdk: null,
@@ -10,7 +10,10 @@ let api = {
1010
}
1111
let appwrite = new Appwrite();
1212
appwrite.setEndpoint(Server.endpoint).setProject(Server.project);
13-
api.sdk = appwrite;
13+
const account = new Account(appwrite);
14+
const database = new Databases(appwrite, Server.databaseID);
15+
16+
api.sdk = { database, account };
1417
return appwrite;
1518
},
1619

@@ -23,7 +26,7 @@ let api = {
2326
},
2427

2528
createSession: (email, password) => {
26-
return api.provider().account.createSession(email, password);
29+
return api.provider().account.createEmailSession(email, password);
2730
},
2831

2932
deleteCurrentSession: () => {

‎src/utils/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const Server = {
22
endpoint : process.env.REACT_APP_ENDPOINT,
33
project: process.env.REACT_APP_PROJECT,
4-
collectionID : process.env.REACT_APP_COLLECTION_ID
4+
collectionID : process.env.REACT_APP_COLLECTION_ID,
5+
databaseID : process.env.REACT_APP_DATABASE_ID,
56
}

1 commit comments

Comments
 (1)

vercel[bot] commented on Jul 7, 2022

@vercel[bot]
This repository has been archived.