Visual improvements
This commit is contained in:
@@ -14,25 +14,25 @@ import type { Router } from 'vue-router';
|
||||
|
||||
const client = new Client();
|
||||
|
||||
// appwrite.io SaaS
|
||||
// client
|
||||
// .setEndpoint('https://api.bab.toal.ca/v1')
|
||||
// .setProject('653ef6f76baf06d68034');
|
||||
// const appDatabaseId = '654ac5044d1c446feb71';
|
||||
let APPWRITE_API_ENDPOINT, APPWRITE_API_PROJECT;
|
||||
|
||||
// Private self-hosted appwrite
|
||||
if (process.env.APPWRITE_API_ENDPOINT && process.env.APPWRITE_API_PROJECT)
|
||||
client
|
||||
.setEndpoint(process.env.APPWRITE_API_ENDPOINT)
|
||||
.setProject(process.env.APPWRITE_API_PROJECT);
|
||||
else if (process.env.DEV) {
|
||||
client
|
||||
.setEndpoint('http://localhost:4000/api/v1')
|
||||
.setProject('65ede55a213134f2b688');
|
||||
if (process.env.APPWRITE_API_ENDPOINT && process.env.APPWRITE_API_PROJECT) {
|
||||
APPWRITE_API_ENDPOINT = process.env.APPWRITE_API_ENDPOINT;
|
||||
APPWRITE_API_PROJECT = process.env.APPWRITE_API_PROJECT;
|
||||
} else if (process.env.DEV) {
|
||||
APPWRITE_API_ENDPOINT = 'http://localhost:4000/api/v1';
|
||||
APPWRITE_API_PROJECT = '65ede55a213134f2b688';
|
||||
} else {
|
||||
client.setEndpoint('https://appwrite.oys.undock.ca/v1').setProject('bab');
|
||||
APPWRITE_API_ENDPOINT = 'https://appwrite.oys.undock.ca/v1';
|
||||
APPWRITE_API_PROJECT = 'bab';
|
||||
}
|
||||
//TODO move this to config file
|
||||
client.setEndpoint(APPWRITE_API_ENDPOINT).setProject(APPWRITE_API_PROJECT);
|
||||
|
||||
const pwresetUrl = process.env.DEV
|
||||
? 'http://localhost:4000/pwreset'
|
||||
: 'https://oys.undock.ca/pwreset';
|
||||
|
||||
const AppwriteIds = process.env.DEV
|
||||
? {
|
||||
databaseId: '65ee1cbf9c2493faf15f',
|
||||
@@ -121,20 +121,36 @@ async function login(email: string, password: string) {
|
||||
console.log('Redirecting to index page');
|
||||
appRouter.replace({ name: 'index' });
|
||||
} catch (error: unknown) {
|
||||
notification({
|
||||
type: 'negative',
|
||||
message: 'Login failed.',
|
||||
timeout: 2000,
|
||||
});
|
||||
if (error instanceof AppwriteException) {
|
||||
if (error.type === 'user_session_already_exists') {
|
||||
appRouter.replace({ name: 'index' });
|
||||
notification({
|
||||
type: 'positive',
|
||||
message: 'Already Logged in!',
|
||||
timeout: 2000,
|
||||
spinner: false,
|
||||
icon: 'check_circle',
|
||||
});
|
||||
return;
|
||||
}
|
||||
Dialog.create({
|
||||
title: 'Login Error!',
|
||||
message: error.message,
|
||||
persistent: true,
|
||||
});
|
||||
}
|
||||
notification({
|
||||
type: 'negative',
|
||||
message: 'Login failed.',
|
||||
timeout: 2000,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function resetPassword(email: string) {
|
||||
await account.createRecovery(email, pwresetUrl);
|
||||
}
|
||||
|
||||
export {
|
||||
client,
|
||||
account,
|
||||
@@ -145,4 +161,5 @@ export {
|
||||
AppwriteIds,
|
||||
login,
|
||||
logout,
|
||||
resetPassword,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user