Redux -> simple fixes
parent
e1cd04420f
commit
08102edbd0
|
|
@ -3,7 +3,7 @@ import { GeneralAddress } from './abstractAddress'
|
|||
|
||||
const APIAddress = 'http://' + GeneralAddress
|
||||
|
||||
let defaultBody = ''
|
||||
let defaultBody = {}
|
||||
|
||||
const _getList = async (endpoint, token) => {
|
||||
return await responseAbstract(
|
||||
|
|
|
|||
|
|
@ -45,14 +45,26 @@ const __make_address = async (endpoint) => {
|
|||
return GeneralAddress + endpoint
|
||||
}
|
||||
|
||||
/**
|
||||
* @param body:
|
||||
* param token: token
|
||||
* param endpoint:
|
||||
* examples:
|
||||
* 'image' - connect to single image ws renderer
|
||||
* 'set' - connect to single set ws renderer
|
||||
* 'all' - connect to all ws renderer
|
||||
*
|
||||
* 'vector/image' - connect to vector single image ws renderer
|
||||
* 'vector/set' - connerct to vector single set ws renderer
|
||||
*/
|
||||
const fetchConnect = createAsyncThunk(
|
||||
'render/async/fetchConnect',
|
||||
async (
|
||||
endpoint,
|
||||
body,
|
||||
thunkAPI
|
||||
) => {
|
||||
let uuid = __uuidv4()
|
||||
let address = __make_address(endpoint)
|
||||
let address = __make_address(body.endpoint)
|
||||
return {
|
||||
web_socket: new WebSocket(address + uuid),
|
||||
address: address,
|
||||
|
|
@ -61,21 +73,31 @@ const fetchConnect = createAsyncThunk(
|
|||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* @param body:
|
||||
* param token: token
|
||||
* param message: message string
|
||||
*/
|
||||
const fetchSaveMessage = createAsyncThunk(
|
||||
'render/async/fetchSaveMessage',
|
||||
async (
|
||||
message,
|
||||
body,
|
||||
thunkAPI
|
||||
) => {
|
||||
return {
|
||||
message: message
|
||||
message: body.message
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* @param body:
|
||||
* param token: token
|
||||
*/
|
||||
const fetchDisconnect = createAsyncThunk(
|
||||
'render/async/fetchDisconnect',
|
||||
async (
|
||||
token,
|
||||
thunkAPI
|
||||
) => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,6 @@ const renderWebsocketSlice = createSlice(
|
|||
}
|
||||
)
|
||||
|
||||
export const userAuthReducer = userAuthSlice.reducer
|
||||
export const renderWebsocketReducer = renderWebsocketSlice.reducer
|
||||
|
||||
export const userAuthSelector = state => state.userAuthReducer
|
||||
export const renderWebsocketSelector = state => state.renderWebsocketReducer
|
||||
Loading…
Reference in New Issue