Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

feat: update Appwrite to support 0.15.x #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@tailwindcss/forms": "^0.3.2",
"@tailwindcss/typography": "^0.4.0",
"angular-svg-icon": "^13.0.0",
"appwrite": "^8.0.0",
"appwrite": "^9.0.0",
"rxjs": "^7.4.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
Expand Down
9 changes: 6 additions & 3 deletions src/app/helpers/api.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Appwrite } from 'appwrite';
import { Account, Client as Appwrite, Databases } from 'appwrite';
import { Server } from '../utils/config';

export class Api {
private static sdk: Appwrite | null;
private static sdk: { account: Account, database: Databases } | null;

static provider() {
if (this.sdk) return this.sdk;
Expand All @@ -11,7 +11,10 @@ export class Api {
.setEndpoint(Server.endpoint)
.setProject(Server.project)
.setLocale('en-US');
this.sdk = client;

const database = new Databases(client, Server.databaseID);
const account = new Account(client);
this.sdk = { account, database };
return this.sdk;
}
}
4 changes: 2 additions & 2 deletions src/app/store/account/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class AccountState {
) {
let { email, password } = action.payload;
try {
await Api.provider().account.createSession(email, password);
await Api.provider().account.createEmailSession(email, password);
let account = await Api.provider().account.get();
patchState({
account: account,
Expand Down Expand Up @@ -100,7 +100,7 @@ export class AccountState {
password,
name
);
let session = await Api.provider().account.createSession(email, password);
let session = await Api.provider().account.createEmailSession(email, password);
patchState({
account,
session,
Expand Down
3 changes: 2 additions & 1 deletion src/app/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import { environment } from '../../environments/environment';
export const Server = {
endpoint : environment.APP_ENDPOINT,
project: environment.APP_PROJECT,
collectionID : environment.APP_COLLECTION_ID
collectionID : environment.APP_COLLECTION_ID,
databaseID : environment.APP_DATABASE_ID
}
3 changes: 2 additions & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export const environment = {
production: false,
APP_ENDPOINT: "https://demo.appwrite.io/v1",
APP_PROJECT: "6062f9c2c09ce",
APP_COLLECTION_ID:"606621a04837c"
APP_COLLECTION_ID:"606621a04837c",
APP_DATABASE_ID: "default"
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want users testing this on their local? It was a bit confusing how we have React to-do with that setup and not Angular.


/*
Expand Down