|
@@ -81,6 +81,7 @@ function DataTableContent() {
|
|
|
|
|
|
|
|
const [balance, setBalance] = useState<number>(0)
|
|
const [balance, setBalance] = useState<number>(0)
|
|
|
const [tokenName, setTokenName] = useState<string>('')
|
|
const [tokenName, setTokenName] = useState<string>('')
|
|
|
|
|
+ const [userAddress, setUserAddress] = useState<string>('')
|
|
|
const userAddressRef = useRef<string>('')
|
|
const userAddressRef = useRef<string>('')
|
|
|
const poolsListRef = useRef<PoolsListResponse>({
|
|
const poolsListRef = useRef<PoolsListResponse>({
|
|
|
retCode: 0,
|
|
retCode: 0,
|
|
@@ -135,7 +136,10 @@ function DataTableContent() {
|
|
|
fetch('/api/my-lp/getAddress')
|
|
fetch('/api/my-lp/getAddress')
|
|
|
.then((res) => res.json())
|
|
.then((res) => res.json())
|
|
|
.then((data) => {
|
|
.then((data) => {
|
|
|
- userAddressRef.current = data.address
|
|
|
|
|
|
|
+ if (data.address) {
|
|
|
|
|
+ userAddressRef.current = data.address
|
|
|
|
|
+ setUserAddress(data.address)
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
|
console.error('Error fetching address:', err)
|
|
console.error('Error fetching address:', err)
|
|
@@ -434,6 +438,15 @@ function DataTableContent() {
|
|
|
</span>
|
|
</span>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 当地址获取后,设置页面标题为地址后四位字母
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ if (userAddress) {
|
|
|
|
|
+ const lastFour = userAddress.slice(-4)
|
|
|
|
|
+ document.title = lastFour
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [userAddress])
|
|
|
|
|
+
|
|
|
const columns = [
|
|
const columns = [
|
|
|
{
|
|
{
|
|
|
title: '创建地址',
|
|
title: '创建地址',
|