Skip to content

Commit

Permalink
feat(global): print dashboard version in browser console
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon authored and ysfscream committed Oct 18, 2024
1 parent f5999bb commit d8c5e10
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
</template>

<script setup lang="ts">
import useDashboardVersion from '@/hooks/useDashboardVersion'
import { computed } from 'vue'
import { useStore } from 'vuex'
Expand Down Expand Up @@ -56,6 +57,9 @@ setWatchOSTheme()
if (syncOsTheme.value) {
hadleSyncOSTheme()
}
const { printVersion } = useDashboardVersion()
printVersion()
</script>

<style lang="scss"></style>
26 changes: 26 additions & 0 deletions src/hooks/useDashboardVersion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import axios from 'axios'

export default (): {
printVersion: () => Promise<void>
} => {
const versionReg = /refs\/tags\/(.+)/
const printVersion = async () => {
try {
const { data: versionContent } = await axios({
method: 'get',
url: 'version',
baseURL: '',
})
debugger
const version = versionContent.match(versionReg)?.[1]
if (version) {
console.log('🔎 Dashboard Version:', version)
}
} catch (error) {
//
}
}
return {
printVersion,
}
}

0 comments on commit d8c5e10

Please sign in to comment.