Skip to content

Commit 37e37dc

Browse files
Remove the repeated method
1 parent a5cc3b8 commit 37e37dc

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

frontend/src/stores/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const toBoolean = (value: any): boolean => {
1515
return Boolean(value)
1616
}
1717

18-
const generateUUID = (): string => {
18+
export const generateUUID = (): string => {
1919
let d = new Date().getTime()
2020
let d2 = (performance?.now() * 1000) || 0
2121
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {

frontend/src/views/Sign/index.vue

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
<script setup lang="ts">
197197
import { ref, onMounted, watch } from 'vue'
198198
import { useRouter, useRoute } from 'vue-router'
199-
import { useAppStore } from '@/stores/app'
199+
import { useAppStore, generateUUID } from '@/stores/app'
200200
import config from '@/config'
201201
202202
const router = useRouter()
@@ -359,21 +359,6 @@ onMounted(() => {
359359
}
360360
})
361361
362-
const generateUUID = (): string => {
363-
let d = new Date().getTime()
364-
let d2 = (performance?.now() * 1000) || 0
365-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
366-
let r = Math.random() * 16
367-
if (d > 0) {
368-
r = (d + r) % 16 | 0
369-
d = Math.floor(d / 16)
370-
} else {
371-
r = (d2 + r) % 16 | 0
372-
d2 = Math.floor(d2 / 16)
373-
}
374-
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16)
375-
})
376-
}
377362
</script>
378363

379364
<style src="./Sign.scss" scoped lang="scss"></style>

0 commit comments

Comments
 (0)