refactor: Configuration improvement
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m13s

This commit is contained in:
2024-06-17 15:37:45 -04:00
parent 6ec4a1e025
commit a409b0a5c7
2 changed files with 56 additions and 42 deletions

View File

@@ -14,25 +14,37 @@ import type { Router } from 'vue-router';
const client = new Client(); const client = new Client();
const VITE_APPWRITE_API_ENDPOINT = import.meta.env.VITE_APPWRITE_API_ENDPOINT; const API_ENDPOINT = import.meta.env.VITE_APPWRITE_API_ENDPOINT;
const VITE_APPWRITE_API_PROJECT = import.meta.env.VITE_APPWRITE_API_PROJECT; const API_PROJECT = import.meta.env.VITE_APPWRITE_API_PROJECT;
if (VITE_APPWRITE_API_ENDPOINT && VITE_APPWRITE_API_PROJECT) { if (API_ENDPOINT && API_PROJECT) {
client client.setEndpoint(API_ENDPOINT).setProject(API_PROJECT);
.setEndpoint(VITE_APPWRITE_API_ENDPOINT)
.setProject(VITE_APPWRITE_API_PROJECT);
} else { } else {
console.error( console.error(
'Must configure VITE_APPWRITE_API_ENDPOINT and VITE_APPWRITE_API_PROJECT' 'Must configure VITE_APPWRITE_API_ENDPOINT and VITE_APPWRITE_API_PROJECT'
); );
} }
const pwresetUrl = process.env.DEV type AppwriteIDConfig = {
? 'http://localhost:4000/pwreset' databaseId: string;
: 'https://oys.undock.ca/pwreset'; collection: {
boat: string;
reservation: string;
skillTags: string;
task: string;
taskTags: string;
interval: string;
intervalTemplate: string;
};
function: {
userinfo: string;
};
};
const AppwriteIds = process.env.DEV let AppwriteIds = <AppwriteIDConfig>{};
? {
if (API_ENDPOINT === 'https://apidev.bab.toal.ca/v1') {
AppwriteIds = {
databaseId: '65ee1cbf9c2493faf15f', databaseId: '65ee1cbf9c2493faf15f',
collection: { collection: {
boat: 'boat', boat: 'boat',
@@ -46,8 +58,9 @@ const AppwriteIds = process.env.DEV
function: { function: {
userinfo: 'userinfo', userinfo: 'userinfo',
}, },
} };
: { } else if (API_ENDPOINT === 'https://appwrite.oys.undock.ca/v1') {
AppwriteIds = {
databaseId: 'bab_prod', databaseId: 'bab_prod',
collection: { collection: {
boat: 'boat', boat: 'boat',
@@ -62,6 +75,7 @@ const AppwriteIds = process.env.DEV
userinfo: '664038294b5473ef0c8d', userinfo: '664038294b5473ef0c8d',
}, },
}; };
}
const account = new Account(client); const account = new Account(client);
const databases = new Databases(client); const databases = new Databases(client);
@@ -146,7 +160,7 @@ async function login(email: string, password: string) {
} }
async function resetPassword(email: string) { async function resetPassword(email: string) {
await account.createRecovery(email, pwresetUrl); await account.createRecovery(email, window.location.origin + '/pwreset');
} }
export { export {

View File

@@ -3,7 +3,7 @@
<q-card <q-card
v-for="boat in boats" v-for="boat in boats"
:key="boat.id" :key="boat.id"
class="mobile-card q-ma-sm"> class="q-ma-sm">
<q-card-section> <q-card-section>
<q-img <q-img
:src="boat.imgSrc" :src="boat.imgSrc"