refactor user and app service

This commit is contained in:
2024-03-12 00:34:58 +08:00
parent 9c6cbd91ff
commit eaa22dcaa5
3 changed files with 37 additions and 27 deletions
+3 -16
View File
@@ -1,26 +1,13 @@
import { PropsWithChildren } from 'react';
import Taro, { useLaunch } from '@tarojs/taro';
import { getUrl } from '@/service';
import pt from '@/plain-text';
import { useLaunch } from '@tarojs/taro';
import 'taro-ui/dist/style/index.scss';
import './app.scss';
import { getLocaleData } from './service/localeData';
function App({ children }: PropsWithChildren<any>) {
useLaunch(() => {
console.log('App launched.');
Taro.request({
url: getUrl('/user/locale/get'),
method: 'GET',
data: {
token: 'token_test',
},
}).then(res => {
console.log(res.data);
pt.setLang(res.data.data.lang);
Taro.reLaunch({
url: '/pages/index/index',
});
});
getLocaleData();
});
// children 是将要会渲染的页面