Redux -> simple fixes
parent
e1cd04420f
commit
08102edbd0
|
|
@ -3,7 +3,7 @@ import { GeneralAddress } from './abstractAddress'
|
||||||
|
|
||||||
const APIAddress = 'http://' + GeneralAddress
|
const APIAddress = 'http://' + GeneralAddress
|
||||||
|
|
||||||
let defaultBody = ''
|
let defaultBody = {}
|
||||||
|
|
||||||
const _getList = async (endpoint, token) => {
|
const _getList = async (endpoint, token) => {
|
||||||
return await responseAbstract(
|
return await responseAbstract(
|
||||||
|
|
|
||||||
|
|
@ -45,14 +45,26 @@ const __make_address = async (endpoint) => {
|
||||||
return GeneralAddress + 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(
|
const fetchConnect = createAsyncThunk(
|
||||||
'render/async/fetchConnect',
|
'render/async/fetchConnect',
|
||||||
async (
|
async (
|
||||||
endpoint,
|
body,
|
||||||
thunkAPI
|
thunkAPI
|
||||||
) => {
|
) => {
|
||||||
let uuid = __uuidv4()
|
let uuid = __uuidv4()
|
||||||
let address = __make_address(endpoint)
|
let address = __make_address(body.endpoint)
|
||||||
return {
|
return {
|
||||||
web_socket: new WebSocket(address + uuid),
|
web_socket: new WebSocket(address + uuid),
|
||||||
address: address,
|
address: address,
|
||||||
|
|
@ -61,21 +73,31 @@ const fetchConnect = createAsyncThunk(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param body:
|
||||||
|
* param token: token
|
||||||
|
* param message: message string
|
||||||
|
*/
|
||||||
const fetchSaveMessage = createAsyncThunk(
|
const fetchSaveMessage = createAsyncThunk(
|
||||||
'render/async/fetchSaveMessage',
|
'render/async/fetchSaveMessage',
|
||||||
async (
|
async (
|
||||||
message,
|
body,
|
||||||
thunkAPI
|
thunkAPI
|
||||||
) => {
|
) => {
|
||||||
return {
|
return {
|
||||||
message: message
|
message: body.message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param body:
|
||||||
|
* param token: token
|
||||||
|
*/
|
||||||
const fetchDisconnect = createAsyncThunk(
|
const fetchDisconnect = createAsyncThunk(
|
||||||
'render/async/fetchDisconnect',
|
'render/async/fetchDisconnect',
|
||||||
async (
|
async (
|
||||||
|
token,
|
||||||
thunkAPI
|
thunkAPI
|
||||||
) => {
|
) => {
|
||||||
return {
|
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