mirror of
https://github.com/Macrame-App/Macrame
synced 2025-12-29 07:19:26 +00:00
App.vue and router update to include authorization.
This commit is contained in:
parent
c4d66d130c
commit
d38f999b27
2 changed files with 35 additions and 5 deletions
|
|
@ -5,20 +5,41 @@
|
||||||
</div>
|
</div>
|
||||||
<MainMenu />
|
<MainMenu />
|
||||||
<RouterView />
|
<RouterView />
|
||||||
|
<AlertComp
|
||||||
|
v-if="!isLocal() && !handshake && route.fullPath !== '/devices'"
|
||||||
|
variant="warning"
|
||||||
|
:page-wide="true"
|
||||||
|
href="/devices"
|
||||||
|
>
|
||||||
|
<h4>Not authorized!</h4>
|
||||||
|
<p>Click here to start authorization and open the "Devices" page on your PC.</p>
|
||||||
|
</AlertComp>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import MainMenu from '@/components/base/MainMenu.vue'
|
import MainMenu from '@/components/base/MainMenu.vue'
|
||||||
import { onMounted } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import { RouterView } from 'vue-router'
|
import { RouterView, useRoute } from 'vue-router'
|
||||||
import { useDeviceStore } from './stores/device'
|
import { useDeviceStore } from './stores/device'
|
||||||
|
import { isLocal } from './services/ApiService'
|
||||||
|
import AlertComp from './components/base/AlertComp.vue'
|
||||||
|
|
||||||
const device = useDeviceStore()
|
const device = useDeviceStore()
|
||||||
|
|
||||||
onMounted(() => {
|
const route = useRoute()
|
||||||
|
const handshake = ref(false)
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
device.uuid()
|
||||||
|
|
||||||
|
const hsReq = await device.remoteHandshake()
|
||||||
|
handshake.value = hsReq
|
||||||
|
|
||||||
|
device.$subscribe((mutation, state) => {
|
||||||
|
console.log(mutation)
|
||||||
|
})
|
||||||
// Setting device uuid from localstorage
|
// Setting device uuid from localstorage
|
||||||
// If not present in LocalStorage a new uuidV4 will be generated
|
// If not present in LocalStorage a new uuidV4 will be generated
|
||||||
device.uuid()
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -45,7 +66,6 @@ onMounted(() => {
|
||||||
top-[10%]
|
top-[10%]
|
||||||
left-[10%]
|
left-[10%]
|
||||||
scale-[1.8]
|
scale-[1.8]
|
||||||
p-28
|
|
||||||
opacity-35
|
opacity-35
|
||||||
mix-blend-overlay;
|
mix-blend-overlay;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,16 @@ const router = createRouter({
|
||||||
name: 'panels',
|
name: 'panels',
|
||||||
component: () => import('../views/PanelsView.vue'),
|
component: () => import('../views/PanelsView.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/panel/edit/:dirname',
|
||||||
|
name: 'panel-edit',
|
||||||
|
component: () => import('../views/PanelsView.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/panel/view/:dirname',
|
||||||
|
name: 'panel-view',
|
||||||
|
component: () => import('../views/PanelsView.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/macros',
|
path: '/macros',
|
||||||
name: 'macros',
|
name: 'macros',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue