Skip to content

Commit 92e698a

Browse files
committed
updated bug: on refresh, the app is not fetching the current logged in account
1 parent 48dc8b4 commit 92e698a

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"web-vitals": "^1.0.1"
1313
},
1414
"scripts": {
15-
"start": "craco start",
15+
"start": "craco --openssl-legacy-provider start",
1616
"build": "craco build",
1717
"lint": "eslint ./src",
1818
"test": "craco test",

src/api/api.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Client as Appwrite, Databases, Account } 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,
@@ -14,29 +14,30 @@ let api = {
1414
const database = new Databases(appwrite, Server.databaseID);
1515

1616
api.sdk = { database, account };
17-
return appwrite;
17+
return api.sdk;
1818
},
1919

2020
createAccount: (email, password, name) => {
21-
return api.provider().account.create('unique()', email, password, name);
21+
return api.provider().account.create("unique()", email, password, name);
2222
},
2323

2424
getAccount: () => {
25-
return api.provider().account.get();
25+
let account = api.provider().account;
26+
return account.get();
2627
},
2728

2829
createSession: (email, password) => {
2930
return api.provider().account.createEmailSession(email, password);
3031
},
3132

3233
deleteCurrentSession: () => {
33-
return api.provider().account.deleteSession('current');
34+
return api.provider().account.deleteSession("current");
3435
},
3536

3637
createDocument: (collectionId, data, read, write) => {
3738
return api
3839
.provider()
39-
.database.createDocument(collectionId, 'unique()', data, read, write);
40+
.database.createDocument(collectionId, "unique()", data, read, write);
4041
},
4142

4243
listDocuments: (collectionId) => {

0 commit comments

Comments
 (0)