refactor: remove unnecessary utils (#49)

This commit is contained in:
chenbin92 2020-02-24 12:37:40 +08:00 committed by GitHub
parent 2cdc63674d
commit da097f6d81
2 changed files with 0 additions and 21 deletions

View File

@ -1,2 +0,0 @@
export { withRouter, matchPath, generatePath } from 'react-router-dom'
export { getLocale, setLocale } from './locale'

View File

@ -1,19 +0,0 @@
function setLocale(lang: string) {
if (lang !== undefined && !/^([a-z]{2})-([A-Z]{2})$/.test(lang)) {
throw new Error('setLocale lang format error');
}
if (getLocale() !== lang) {
window.localStorage.setItem('lang', lang);
window.location.reload();
}
}
function getLocale() {
if (!window.localStorage.getItem('lang')) {
window.localStorage.setItem('lang', navigator.language);
}
return localStorage.getItem('lang');
}
export { setLocale, getLocale };