|  |  |  | 
|---|
|  |  |  | import React, { useState, useRef, useEffect, useMemo } from "react"; | 
|---|
|  |  |  | import { useTranslate } from "react-admin"; | 
|---|
|  |  |  | import { | 
|---|
|  |  |  | Fab, | 
|---|
|  |  |  | } from '@mui/material'; | 
|---|
|  |  |  | import LensBlurIcon from '@mui/icons-material/LensBlur'; | 
|---|
|  |  |  | import { getFakeSign, setFakeSign } from "../http"; | 
|---|
|  |  |  | import { VERIFY_PASSWORD } from '@/config/setting'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const FakeFab = (props) => { | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  | const [fakeRun, setFakeRun] = useState(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | useEffect(() => { | 
|---|
|  |  |  | 
|---|
|  |  |  | let pass = true; | 
|---|
|  |  |  | if (!res) { | 
|---|
|  |  |  | const pwd = prompt("please enter password:"); | 
|---|
|  |  |  | if (pwd === 'xltys1995') { | 
|---|
|  |  |  | if (pwd === VERIFY_PASSWORD) { | 
|---|
|  |  |  | pass = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | pass = false; | 
|---|
|  |  |  | if (!pwd) { | 
|---|
|  |  |  | if (pwd) { | 
|---|
|  |  |  | alert('Incorrect password'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | onClick={handleToggle} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <LensBlurIcon /> | 
|---|
|  |  |  | {/*  {translate('page.map.action.adapt')} */} | 
|---|
|  |  |  |  {translate('page.map.action.fake')}  | 
|---|
|  |  |  | </Fab> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | ) | 
|---|