MCPcopy
hub / github.com/modelscope/FunASR / checkNecessaryData

Function checkNecessaryData

web-pages/src/main.js:102–130  ·  view source on GitHub ↗
(callbackFun)

Source from the content-addressed store, hash-verified

100
101// 获取必要的数据
102const checkNecessaryData = (callbackFun) => {
103 const promiseList = []
104 if (promiseList.length > 0) {
105 Promise.all(promiseList)
106 .then((res) => {
107 localStorage.removeItem('getInitDataErrorCount')
108 callbackFun && callbackFun()
109 })
110 .catch((res) => {
111 const errorCount = localStorage.getItem(
112 'getInitDataErrorCount'
113 )
114 if (errorCount) {
115 let count = Number.parseInt(errorCount)
116 if (count <= 3) {
117 localStorage.setItem('getInitDataErrorCount', ++count)
118 // 菜单或者用户角色列表数据请求失败,就刷新页面
119 window.location.reload(window.location.href)
120 }
121 } else {
122 localStorage.setItem('getInitDataErrorCount', 1)
123 // 菜单或者用户角色列表数据请求失败,就刷新页面
124 window.location.reload(window.location.href)
125 }
126 })
127 } else {
128 callbackFun && callbackFun()
129 }
130}
131
132router.beforeEach((to, from, next) => {
133 checkNecessaryData(() => {

Callers 1

main.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…