33 lines
647 B
TypeScript
33 lines
647 B
TypeScript
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',
|
|
});
|
|
});
|
|
}
|