filter mid 수정
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import * as _ from 'lodash-es';
|
||||
import {
|
||||
Fragment,
|
||||
useCallback,
|
||||
@@ -88,6 +89,10 @@ export const SubLayout = () => {
|
||||
};
|
||||
homeGroups(params).then((rs: HomeGroupsResponse) => {
|
||||
useStore.getState().UserStore.setUserMids(rs.mids);
|
||||
if(!!rs.mids[0]){
|
||||
useStore.getState().UserStore.setMid(rs.mids[0]);
|
||||
setMid(rs.mids[0]);
|
||||
}
|
||||
let options: Array<Record<string, string>> = rs.mids.map((value, index) => {
|
||||
return {
|
||||
name: value,
|
||||
@@ -95,11 +100,20 @@ export const SubLayout = () => {
|
||||
};
|
||||
});
|
||||
useStore.getState().UserStore.setSelectOptionsMids(options);
|
||||
|
||||
let options2 = _.cloneDeep(options);
|
||||
options2.sort((a: Record<string, any>, b: Record<string, any>) => {
|
||||
if(a.value.toLowerCase() > b.value.toLowerCase()) return 1;
|
||||
else if(a.value.toLowerCase() < b.value.toLowerCase()) return -1;
|
||||
else return 0;
|
||||
});
|
||||
let optionsWithoutGids = options2.filter((value: Record<string, any>, index: number) => {
|
||||
let last = value.value.slice(-1);
|
||||
return last.toLowerCase() !== 'g';
|
||||
});
|
||||
console.log(options)
|
||||
useStore.getState().UserStore.setSelectOptionsMidsWithoutGids(optionsWithoutGids);
|
||||
|
||||
if(!!rs.mids[0]){
|
||||
useStore.getState().UserStore.setMid(rs.mids[0]);
|
||||
setMid(rs.mids[0]);
|
||||
}
|
||||
setLoginSuccess(true);
|
||||
setHeaderNavigationKey(headerNavigationKey + 1);
|
||||
|
||||
@@ -223,14 +237,17 @@ export const SubLayout = () => {
|
||||
const handleLogin = useCallback(async () => {
|
||||
let userParmas;
|
||||
if(!isNativeEnvironment){
|
||||
/*
|
||||
userParmas = {
|
||||
id: 'nictest00',
|
||||
password: 'nictest00'
|
||||
};
|
||||
// userParmas = {
|
||||
// id: 'woowahan5',
|
||||
// password: 'nictest00'
|
||||
// };
|
||||
|
||||
*/
|
||||
userParmas = {
|
||||
id: 'woowahan5',
|
||||
password: 'nictest00'
|
||||
};
|
||||
|
||||
}
|
||||
callLogin(userParmas).then(() => {
|
||||
|
||||
Reference in New Issue
Block a user