import { AtActivityIndicator } from 'taro-ui';
import { Component, ReactNode } from 'react';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import { View } from '@tarojs/components';
import wechatUser from '@/wechat';
import './Loading.scss';

export default class LoadingPage extends Component {
  componentDidMount(): void {
    Taro.setNavigationBarTitle({
      title: pt.get().navBar.loading,
    });
    if (wechatUser.getToken()) {
      Taro.reLaunch({
        url: '/pages/index/index',
      });
    }
  }
  render(): ReactNode {
    return (
      <View>
        <AtActivityIndicator
          mode='center'
          content={pt.get().actIndicator.loading}
        ></AtActivityIndicator>
      </View>
    );
  }
}
