short share urls
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<v-btn id="share-btn" variant="text" prepend-icon="mdi-share" v-if="co.orders.length>0"
|
||||
:disabled="sharing"
|
||||
@click="shareOrder">{{sharing?'Preparing...':'Share'}}</v-btn>
|
||||
<v-tooltip activator="#share-btn" text="Copied share link!" v-model="showSharedTooltip"
|
||||
<v-tooltip activator="#share-btn" :text="shareError?'Error copying share link :(':'Copied share link!'" v-model="showSharedTooltip"
|
||||
:open-on-hover="false" :open-on-click="false"
|
||||
/>
|
||||
</template>
|
||||
@@ -205,6 +205,7 @@ async function doPlaceOrder() {
|
||||
|
||||
const sharing = ref(false)
|
||||
const showSharedTooltip = ref(false)
|
||||
const shareError = ref(false)
|
||||
const showShareDialog = ref(false)
|
||||
const shareUrl = ref(null)
|
||||
|
||||
@@ -212,6 +213,12 @@ function shareOrder() {
|
||||
sharing.value = true
|
||||
track('share')
|
||||
getShareUrl().then(url => {
|
||||
shareError.value = url === null
|
||||
if (url === null) {
|
||||
sharing.value = false
|
||||
return
|
||||
}
|
||||
console.log('share url', url)
|
||||
shareUrl.value = url
|
||||
sharing.value = false
|
||||
navigator.permissions.query({name: "clipboard-write"}).then((permission) => {
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
<template>
|
||||
<h2>Shared Order</h2>
|
||||
<p>Loading the shared order into the app...</p>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {loadShareUrl} from "@/share.js";
|
||||
import router from "@/router/index.js";
|
||||
import {socket} from "@/socket.js";
|
||||
import {useRoute} from "vue-router";
|
||||
|
||||
loadShareUrl()
|
||||
router.replace('/order')
|
||||
const route = useRoute()
|
||||
const code = route.params.code
|
||||
loadShareUrl(code).then(()=> router.replace('/order')).catch((e)=> {console.error(e); router.replace('/order')})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user