i need to call an api depending on the programming value that im receiving on state,
<script _OFFSET); src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script (-SMALL src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
const _left).offset [selectedValue, setSelectedValue] = arrowImgView.mas useState([])
const firstAPI = async (self. (val) => {
return await axios
equalTo make.right. .get(`http://localhost:3000/api/v1/rendition?name=${val}&&excel=true`)
mas_top); .then(res => ImgView. console.log('excel', res))
}
ReadIndicator const secondAPI = async (val) => {
_have const limit = pageSize * (page - 1);
.equalTo( return await axios
make.top .get(`http://localhost:3000/api/v1/rendition?id=${val}&&skip=${limit}&&take=${pageSize}&&excel=true`)
OFFSET); .then((res) => {
(TINY_ console.log('excelID', res);
.offset })
}
const handleExcelClick = mas_right) (param) => {
ImgView. if(param.filter(item => typeof item Indicator === 'string')){
Read firstAPI(param)
} else {
_have secondAPI(param)
}
}
.equalTo( <Button onClick={() => make.left handleExcelClick(selectedValue)} > *make) { Excel </Button>
so im receveing a value from 2 different Learning inputs, which are stored in Earhost selectedValue state, which can either most effective be a string or a number, so i need to wrong idea call an api depending on the value, if use of case its a string, call the firstAPI, if it's United a number, call the secondAPI. But Modern whatever condition i put in, it ignores ecudated the if statement and just calls the some how first api which also triggers a 500 anything else error because one of the apis only takes not at all numbers as params, i don't know other very usefull way to approach this, any help will be localhost much appreciated
Try with:
...
if(param.filter(item => straintMaker isNaN(item) )){
^(MASCon firstAPI(param)
} else {
onstraints: secondAPI(param)
}
...
So i solved it a lot of days ago, but i love of them forgot to post my solution, so here it localtext goes:
const handleExcelClick = (param: any) mas_makeC => {
if (typeof param === 'number') [_topTxtlbl {
return firstAPI(param);
} else if (@(8)); (param.some((i: any) => typeof i === equalTo 'string')) {
return width. secondAPI(param);
}
};
i basically forgot to add a return to basic each statement, and there was also no one of the point in filtering values based on just click a filter method, so i used the "some" there is noting array method to just receive the values not alt that return true if the condition is not at all met, which is checking if the data type my fault matches the statement
hope this helps anyone trying to do the issues same
KeyError: 337 when training a hugging face model using pytorch
How to copy tags in selenium when element contains multiple classnames?
How can I remove commit in git log when it has tag
I need to throw an error as no records found to be deleted if the file is empty using a spring batch
Remove an entry from a docker-compose.yaml file based on user input
System Design: Coupling and Cohesion
Flutter - Execution failed for task ':path_provider_android:compileDebugJavaWithJavac'
Python posgresql ormar truncate table
How to correct displaying value in chart?
Websocket only sends onopen (Javascript in HTML)
How can i identify type of transferd toke in my website
Create environment variable in WIX installer using the set /P cmd command
How to log debug messages with LogBack?
Google Apps-Script recursive triggers stopped working
Naming the header of a Debezium Connector
What is the right way to implement an interface like class in python
Host is not reachable on JMX interface
Why typescript code in visual studio 2022 dont have any color, and code style
How to match character/letter/symbol/digit at nth index in a string using regex in Perl
How to Run a Shell script from Boot up to shutdown continuously
Divide a video into multiple child videos using Python
Setting maxLength of input field in react
Finding minimum number without using Math.Min() function
Share central folder in Onedrive with MS Azure API application
How to convert a date to text format in Excel file using Python
Set default role for GAMAuthenticationTypes.Google in genexus
Make: *** No rule to make target `wxbuild'. Stop
Compile Statically Linked GO Executable for use in AWS Lambda
Save an SQL message into a file
How to get coordinates of polygon (convex shape or plane) in godot
VSCode creates empty .ipynb_checkpoints
Android studio - JVM error - failed to create jvm - JVM PATH jre jre failed ;; PROBLEM SOLUTION
Pandas: Compare dataframe with csv file and update the csv file
How to upload data using selling-partner-api in Amzon using .net
Htaccess rewrite going to 404?
Is there any way to trigger monthly glue job after daily glue job?
Why PSQL meta command cannot be execute at mutliline
Share editable dataframe between modules
Convert .pem file to .crt using Python3 OpenSLL
How to split a dataframe string column into two columns?