Refactor login and auth
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { boot } from 'quasar/wrappers';
|
||||
import { Client, Account, ID } from 'appwrite';
|
||||
import { Client, Account, Databases, ID } from 'appwrite';
|
||||
import { useAuthStore } from 'src/stores/auth';
|
||||
|
||||
const client = new Client();
|
||||
|
||||
@@ -8,15 +9,14 @@ client
|
||||
.setProject('653ef6f76baf06d68034');
|
||||
|
||||
const account = new Account(client);
|
||||
const databases = new Databases(client);
|
||||
|
||||
// TODO: Auto-logout on session deletion / expiry
|
||||
// account.get().then(
|
||||
// client.subscribe('account', (response) => {
|
||||
// console.log(response);
|
||||
// })
|
||||
// );
|
||||
export default boot(({ app, urlPath, router }) => {
|
||||
// Initialize store
|
||||
const authStore = useAuthStore();
|
||||
authStore.init().then(() => {
|
||||
authStore.currentUser && router.push('/');
|
||||
});
|
||||
});
|
||||
|
||||
// export default boot(({ app, urlPath, redirect }) => {
|
||||
// });
|
||||
|
||||
export { client, account };
|
||||
export { client, account, databases, ID };
|
||||
|
||||
Reference in New Issue
Block a user