fix: obtain scoreinfo
This commit is contained in:
parent
769851ba9f
commit
b232462947
2 changed files with 9 additions and 5 deletions
|
@ -10,9 +10,6 @@ import * as recaptcha from './recaptcha'
|
||||||
import scoreinfo from './scoreinfo'
|
import scoreinfo from './scoreinfo'
|
||||||
|
|
||||||
const main = (): void => {
|
const main = (): void => {
|
||||||
// @ts-ignore
|
|
||||||
if (!window?.UGAPP?.store?.page?.data?.score) { return }
|
|
||||||
|
|
||||||
// init recaptcha
|
// init recaptcha
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
recaptcha.init()
|
recaptcha.init()
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
|
|
||||||
const scoreinfo = {
|
// run at document-start
|
||||||
|
export const ugappJsStore = (() => {
|
||||||
|
const el = document.querySelector('.js-store') as HTMLDivElement
|
||||||
|
const json = el.dataset.content as string
|
||||||
|
return JSON.parse(json)
|
||||||
|
})()
|
||||||
|
|
||||||
|
export const scoreinfo = {
|
||||||
|
|
||||||
get playerdata (): any {
|
get playerdata (): any {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return window.UGAPP.store.page.data.score
|
return ugappJsStore.store.page.data.score
|
||||||
},
|
},
|
||||||
|
|
||||||
get id (this: typeof scoreinfo): number {
|
get id (this: typeof scoreinfo): number {
|
||||||
|
|
Loading…
Reference in a new issue