|
|
|
@ -1,42 +1,29 @@
|
|
|
|
|
import axios from '../../../../modules/utils/customAxiosUtil'; |
|
|
|
|
import qs from 'qs'; |
|
|
|
|
import { createAsyncThunk } from '@reduxjs/toolkit'; |
|
|
|
|
import { isError, isMessage } from '../../comn/message/messageSlice'; |
|
|
|
|
import { |
|
|
|
|
ERROR_MESSAGE, |
|
|
|
|
DUPLATE_MESSAGE, |
|
|
|
|
SAVE_MESSAGE, |
|
|
|
|
DELETE_MESSAGE |
|
|
|
|
} from '@src/configs/constants'; |
|
|
|
|
import { openModal } from '../../comn/message/messageSlice'; |
|
|
|
|
import { QS_OPTION } from '@src/configs/constants'; |
|
|
|
|
import { IAnalysisSimulatorListRq } from './simulationState'; |
|
|
|
|
import { MODAL_DESC, MODAL_TITLE } from '@src/configs/msgConst'; |
|
|
|
|
|
|
|
|
|
// 비행 현황 목록
|
|
|
|
|
export const getSmltList = createAsyncThunk( |
|
|
|
|
'analysis/getSmltList', |
|
|
|
|
async (data: IAnalysisSimulatorListRq, thunkAPI) => { |
|
|
|
|
const { rejectWithValue } = thunkAPI; |
|
|
|
|
try { |
|
|
|
|
const queryString = qs.stringify(data.searchParams, { |
|
|
|
|
addQueryPrefix: true, |
|
|
|
|
arrayFormat: 'repeat' |
|
|
|
|
}); |
|
|
|
|
const queryString = qs.stringify(data.searchParams, QS_OPTION); |
|
|
|
|
const res: any = await axios.get( |
|
|
|
|
`/api/anls/smlt/list${queryString}&page=${data.page}` |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
console.log('>>', res.data); |
|
|
|
|
|
|
|
|
|
return res.data; |
|
|
|
|
} catch (error) { |
|
|
|
|
thunkAPI.dispatch( |
|
|
|
|
isError({ |
|
|
|
|
errorCode: ERROR_MESSAGE.code, |
|
|
|
|
errorMessage: ERROR_MESSAGE.message, |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: false |
|
|
|
|
openModal({ |
|
|
|
|
header: MODAL_TITLE.error, |
|
|
|
|
body: MODAL_DESC.error |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
return rejectWithValue(error); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -45,21 +32,16 @@ export const getSmltList = createAsyncThunk(
|
|
|
|
|
export const getSmltLog = createAsyncThunk( |
|
|
|
|
'analysis/getSmltLog', |
|
|
|
|
async (id: string, thunkAPI) => { |
|
|
|
|
const { rejectWithValue } = thunkAPI; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
const res: any = await axios.get(`/api/anls/smlt/hist/${id}`); |
|
|
|
|
return res.data; |
|
|
|
|
} catch (error) { |
|
|
|
|
thunkAPI.dispatch( |
|
|
|
|
isError({ |
|
|
|
|
errorCode: ERROR_MESSAGE.code, |
|
|
|
|
errorMessage: ERROR_MESSAGE.message, |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: false |
|
|
|
|
openModal({ |
|
|
|
|
header: MODAL_TITLE.error, |
|
|
|
|
body: MODAL_DESC.error |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
return rejectWithValue(error); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -68,21 +50,16 @@ export const getSmltLog = createAsyncThunk(
|
|
|
|
|
export const getSmltDetail = createAsyncThunk( |
|
|
|
|
'analysis/getSmltDetail', |
|
|
|
|
async (id: string, thunkAPI) => { |
|
|
|
|
const { rejectWithValue } = thunkAPI; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
const res: any = await axios.get(`/api/anls/smlt/detail/${id}`); |
|
|
|
|
return res.data; |
|
|
|
|
} catch (error) { |
|
|
|
|
thunkAPI.dispatch( |
|
|
|
|
isError({ |
|
|
|
|
errorCode: ERROR_MESSAGE.code, |
|
|
|
|
errorMessage: ERROR_MESSAGE.message, |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: false |
|
|
|
|
openModal({ |
|
|
|
|
header: MODAL_TITLE.error, |
|
|
|
|
body: MODAL_DESC.error |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
return rejectWithValue(error); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -91,21 +68,16 @@ export const getSmltDetail = createAsyncThunk(
|
|
|
|
|
export const getSmltStcs = createAsyncThunk( |
|
|
|
|
'analysis/getSmltStcs', |
|
|
|
|
async (id: string, thunkAPI) => { |
|
|
|
|
const { rejectWithValue } = thunkAPI; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
const res: any = await axios.get(`/api/anls/smlt/stcs/${id}`); |
|
|
|
|
return res.data; |
|
|
|
|
} catch (error) { |
|
|
|
|
thunkAPI.dispatch( |
|
|
|
|
isError({ |
|
|
|
|
errorCode: ERROR_MESSAGE.code, |
|
|
|
|
errorMessage: ERROR_MESSAGE.message, |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: false |
|
|
|
|
openModal({ |
|
|
|
|
header: MODAL_TITLE.error, |
|
|
|
|
body: MODAL_DESC.error |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
return rejectWithValue(error); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|