refactor user and app service
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt, { Lang } from '@/plain-text';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function setLocaleData(lang: Lang) {
|
||||
Taro.request({
|
||||
url: getUrl('/user/locale/update'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: 'token_test',
|
||||
lang: lang,
|
||||
},
|
||||
}).then(res => {
|
||||
console.log(res.data);
|
||||
});
|
||||
}
|
||||
|
||||
export function getLocaleData() {
|
||||
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',
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user