refactor: Configuration improvement
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m13s
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m13s
This commit is contained in:
@@ -14,54 +14,68 @@ 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>{};
|
||||||
? {
|
|
||||||
databaseId: '65ee1cbf9c2493faf15f',
|
if (API_ENDPOINT === 'https://apidev.bab.toal.ca/v1') {
|
||||||
collection: {
|
AppwriteIds = {
|
||||||
boat: 'boat',
|
databaseId: '65ee1cbf9c2493faf15f',
|
||||||
reservation: 'reservation',
|
collection: {
|
||||||
skillTags: 'skillTags',
|
boat: 'boat',
|
||||||
task: 'task',
|
reservation: 'reservation',
|
||||||
taskTags: 'taskTags',
|
skillTags: 'skillTags',
|
||||||
interval: 'interval',
|
task: 'task',
|
||||||
intervalTemplate: 'intervalTemplate',
|
taskTags: 'taskTags',
|
||||||
},
|
interval: 'interval',
|
||||||
function: {
|
intervalTemplate: 'intervalTemplate',
|
||||||
userinfo: 'userinfo',
|
},
|
||||||
},
|
function: {
|
||||||
}
|
userinfo: 'userinfo',
|
||||||
: {
|
},
|
||||||
databaseId: 'bab_prod',
|
};
|
||||||
collection: {
|
} else if (API_ENDPOINT === 'https://appwrite.oys.undock.ca/v1') {
|
||||||
boat: 'boat',
|
AppwriteIds = {
|
||||||
reservation: 'reservation',
|
databaseId: 'bab_prod',
|
||||||
skillTags: 'skillTags',
|
collection: {
|
||||||
task: 'task',
|
boat: 'boat',
|
||||||
taskTags: 'taskTags',
|
reservation: 'reservation',
|
||||||
interval: 'interval',
|
skillTags: 'skillTags',
|
||||||
intervalTemplate: 'intervalTemplate',
|
task: 'task',
|
||||||
},
|
taskTags: 'taskTags',
|
||||||
function: {
|
interval: 'interval',
|
||||||
userinfo: '664038294b5473ef0c8d',
|
intervalTemplate: 'intervalTemplate',
|
||||||
},
|
},
|
||||||
};
|
function: {
|
||||||
|
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 {
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user