dmikester1
dmikester1
RReactiflux
Created by dmikester1 on 2/19/2024 in #help-js
dmikester1 – 18-25 Feb 19
The plus button and delete last row button I did not want to focus. And it doesn't make sense to move focus to the next row in this app.
16 replies
RReactiflux
Created by dmikester1 on 2/19/2024 in #help-js
dmikester1 – 18-25 Feb 19
Thats what it looks like.
16 replies
RReactiflux
Created by dmikester1 on 2/19/2024 in #help-js
dmikester1 – 18-25 Feb 19
No description
16 replies
RReactiflux
Created by dmikester1 on 2/19/2024 in #help-js
dmikester1 – 18-25 Feb 19
Makes sense, I just wanted the user to be able to tab or enter to auto-calculate all the fields on the page after entering a number into an input.
16 replies
RReactiflux
Created by dmikester1 on 2/19/2024 in #help-js
dmikester1 – 18-25 Feb 19
ok thanks, that makes sense. The focus was going to a couple buttons I didn't want the user to accidentally hit if they hit space or enter on their keyboard. I added tabindex of -1 to those buttons so it goes to another form field now.
16 replies
RReactiflux
Created by dmikester1 on 2/19/2024 in #help-js
dmikester1 – 18-25 Feb 19
Kind of wondering if I need to use onKeyDown checking for tab, and simply override the blur feature of tab using e.stopPropagation or e.preventDefault ?
16 replies
RReactiflux
Created by dmikester1 on 2/19/2024 in #help-js
dmikester1 – 18-25 Feb 19
That didn't do it.
16 replies
RReactiflux
Created by dmikester1 on 2/19/2024 in #help-js
dmikester1 – 18-25 Feb 19
My updateValues function gets called onBlur. At the end of the updateValues function, I tried this:
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur();
}
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur();
}
16 replies
RReactiflux
Created by dmikester1 on 1/12/2024 in #react-forum
Axios helper file with interceptors, how to turn it into a context provider?
I did some more digging and found that there is a way to pass data into the axios interceptor when calling e.g. axios.get(...) => https://stackoverflow.com/a/70647045/571723
4 replies
RReactiflux
Created by dmikester1 on 1/12/2024 in #react-forum
Axios helper file with interceptors, how to turn it into a context provider?
Here is the rest of that code from above:
let result: { accessToken: string }, msalError: string;
axiosInstance.interceptors.request.use((config) => {
config.headers['request-startTime'] = new Date().getTime();

instance
.acquireTokenSilent(tokenRequest)
.then((response) => {
// console.log({ response });
result = { accessToken: response.accessToken };
})
.catch((e) => {
console.log({ e });
msalError = e.message;
});

if(result && result.accessToken) {
const token = result.accessToken; //store.getState().session.token;
config.headers.Authorization = token;
}
return config;
});

axiosInstance.interceptors.response.use((response) => {
const currentTime = new Date().getTime();
const startTime = response.config.headers['request-startTime'];
response.headers['request-duration'] = currentTime - startTime;
return response;
});

export default axiosInstance;
let result: { accessToken: string }, msalError: string;
axiosInstance.interceptors.request.use((config) => {
config.headers['request-startTime'] = new Date().getTime();

instance
.acquireTokenSilent(tokenRequest)
.then((response) => {
// console.log({ response });
result = { accessToken: response.accessToken };
})
.catch((e) => {
console.log({ e });
msalError = e.message;
});

if(result && result.accessToken) {
const token = result.accessToken; //store.getState().session.token;
config.headers.Authorization = token;
}
return config;
});

axiosInstance.interceptors.response.use((response) => {
const currentTime = new Date().getTime();
const startTime = response.config.headers['request-startTime'];
response.headers['request-duration'] = currentTime - startTime;
return response;
});

export default axiosInstance;
4 replies
RReactiflux
Created by dmikester1 on 1/1/2024 in #help-js
dmikester1 – 00-53 Jan 1
Not really sure what I would type into Google for that specific question
6 replies
RReactiflux
Created by dmikester1 on 1/1/2024 in #help-js
dmikester1 – 00-53 Jan 1
It's not actually. 🙂 Trying to figure it out for my job. I guess I can walk through the array and add 1 at a time to a new array. And check if -1 * nextNum equals a number in the array, remove both.
6 replies
RReactiflux
Created by dmikester1 on 11/28/2023 in #help-js
dmikester1 – 18-02 Nov 28
cool, thanks for the tip!
16 replies
RReactiflux
Created by dmikester1 on 11/28/2023 in #help-js
dmikester1 – 18-02 Nov 28
oh, so make a route from my NodeJS backend to do it
16 replies