Skip to content

Commit 386163d

Browse files
committed
Enhance debugging functionality and update Makefile for development
1 parent de7a755 commit 386163d

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dev:
2424
-p $(APP_PORT):3000 \
2525
-p 24678:24678 \
2626
-v $(CURDIR):/data \
27-
$(IMGNAME)
27+
$(IMGNAME) yarn dev
2828

2929
prod:
3030
docker run --rm -it \

src/components/appbar/RightButtons.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ const badgesValues = ref({
3434
})
3535
3636
const auth = useAuth()
37-
const { debug } = useDebug()
37+
3838
// console.log(auth)
3939
const buttons = [
40-
40+
{
41+
icon: 'mdi-bug',
42+
name: 'Debug',
43+
color: 'warning',
44+
action: toggleDebug,
45+
},
4146
{
4247
icon: 'mdi-logout',
4348
name: 'Déconnexion',
@@ -65,4 +70,16 @@ async function syncAll() {
6570
await identityStateStore.fetchSyncedCount()
6671
}
6772
73+
async function toggleDebug() {
74+
const route = useRoute()
75+
const router = useRouter()
76+
77+
const query = { ...route.query }
78+
query.debug = /true|on|yes|1/i.test(query.debug) ? 0 : 1
79+
80+
await router.replace({
81+
query,
82+
})
83+
}
84+
6885
</script>

src/composables/useDebug.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
export function useDebug() {
22
const route = useRoute()
3-
const debug = process.env.NODE_ENV === 'development' || /yes|true|1|on/.test(`${route.query.debug}`)
3+
4+
const debug = computed(() => {
5+
return /yes|true|1|on/.test(`${route.query.debug}`)
6+
})
47

58
return { debug }
69
}

0 commit comments

Comments
 (0)