Add pinia and start working on authentication integration with appwrite

This commit is contained in:
2023-11-05 19:21:03 -05:00
parent e37998f188
commit edde4e79fd
13 changed files with 207 additions and 118 deletions

View File

@@ -1,5 +1,5 @@
import { boot } from 'quasar/wrappers';
import { Client, Account, ID } from 'appwrite';
import { Client, Account } from 'appwrite';
export const client = new Client();
@@ -7,13 +7,17 @@ client
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('653ef6f76baf06d68034');
client.subscribe('account', (response) => {
console.log(response);
});
export const account = new Account(client);
// "async" is optional;
// more info on params: https://v2.quasar.dev/quasar-cli/boot-files
export default boot(async ({ app }) => {
console.log('Appwrite Instantiation');
app.config.globalProperties.$appwrite_client = client;
app.config.globalProperties.$appwrite_account = account;
app.config.globalProperties.$appwrite_ID = ID;
export default boot(({ app, urlPath, redirect }) => {
// Redirect to login page if unauthenticated.
try {
const current = await account.get();
} catch (err) {
redirect('/Login');
}
});