create qr-codes by tg bot
This commit is contained in:
@@ -12,7 +12,9 @@ import type {
|
||||
import { DB_NAMES } from '@/constants/dbNames'
|
||||
|
||||
export const getRemoteDb = <T extends BaseDocument>(dbName: DB_NAMES) =>
|
||||
new PouchDB<T>(`${import.meta.env.VITE_API_URL}/${dbName}`, { skip_setup: true })
|
||||
new PouchDB<T>(new URL(`${import.meta.env.VITE_API_URL}/${dbName}`, location.origin).toString(), {
|
||||
skip_setup: true,
|
||||
})
|
||||
|
||||
export const getLocalDb = <T extends BaseDocument>(dbName: DB_NAMES) => new PouchDB<T>(dbName)
|
||||
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import type { QRCodeDocument } from '@hereconnect/types'
|
||||
import { EPOCH } from '@hereconnect/constants'
|
||||
import { qrCodeDbLocal, qrCodeDbRemote } from '@/api/dbs'
|
||||
import { getUserUuid } from '@/utils/getUserUuid'
|
||||
import { getBrowserUuid } from '@/utils/getBrowserUuid'
|
||||
import { isNotFoundError } from '@/api/PouchDB'
|
||||
|
||||
const EPOHE = 1731661630981
|
||||
|
||||
export const createQrCodeDocument = async (
|
||||
qrCodeDocPartial: Pick<
|
||||
QRCodeDocument,
|
||||
'name' | 'placement' | 'actions' | 'predefinedMessages' | 'messageDeliveryMethod'
|
||||
>,
|
||||
) => {
|
||||
const uri = Math.abs(Date.now() - EPOHE).toString(36)
|
||||
const uri = Math.abs(Date.now() - EPOCH).toString(36)
|
||||
const url = new URL(
|
||||
`${import.meta.env.VITE_READ_BASE_URL || '/read'}/${uri}`,
|
||||
location.origin,
|
||||
|
||||
Reference in New Issue
Block a user