Changed endpoints to environment variables.
This commit is contained in:
parent
f51b5d9e7c
commit
c42772ce47
11
src/env.d.ts
vendored
Normal file
11
src/env.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_SYNCDB_ENDPOINT: string,
|
||||
readonly VITE_SYNCDB_USER: string
|
||||
// more env variables...
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
}
|
||||
@ -213,10 +213,10 @@ export class PouchdbPersistenceManager implements IPersistenceManager {
|
||||
try {
|
||||
|
||||
const syncTarget = "user123";
|
||||
const dbs = await axios.get('https://syncdb-service-d3f974de56ef.herokuapp.com/_all_dbs');
|
||||
const dbs = await axios.get(import.meta.env.VITE_SYNCDB_ENDPOINT);
|
||||
if (dbs.data.indexOf(syncTarget) == -1) {
|
||||
console.log('sync target missing');
|
||||
const buildTarget = await axios.post('https://deepdiagram.com/.netlify/functions/users',
|
||||
const buildTarget = await axios.post(import.meta.env.VITE_USER_ENDPOINT,
|
||||
{username: syncTarget, password: 'password', db: syncTarget});
|
||||
if (buildTarget.status != 200) {
|
||||
console.log(buildTarget.statusText);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user