johnwards
johnwards
Explore posts from servers
RRefine
Created by rival-black on 4/5/2023 in #ask-any-question
Error: A component is changing an uncontrolled input to be controlled.
Good work @kapa.ai
9 replies
RRefine
Created by fascinating-indigo on 4/5/2023 in #ask-any-question
Error: A component is changing an uncontrolled input to be controlled.
Awesome! defaultValue={false} fixed it..
9 replies
RRefine
Created by xenial-black on 4/3/2023 in #ask-any-question
onSettled error when creating a child item
Hmm so playing around a bit more after reading https://tanstack.com/query/v4/docs/react/guides/mutations#consecutive-mutations I created an artwork mutate like this and used it:
const { mutate:artworkMutate } = useCreate();
const { mutate:artworkMutate } = useCreate();
artworkMutate({
resource: `item/${id}/artwork`,
values: formData,
});
artworkMutate({
resource: `item/${id}/artwork`,
values: formData,
});
Is this valid? Am I doing bad things/hacks??
6 replies
RRefine
Created by useful-bronze on 3/15/2023 in #general
Hello is there any guide to using a
Global state management is complicated, only get into it if you need it 😄
16 replies
RRefine
Created by extended-salmon on 3/15/2023 in #general
Hello is there any guide to using a
I'm just setting the value as an in memory variable and grabing it when I need it
16 replies
RRefine
Created by equal-aqua on 3/15/2023 in #general
Hello is there any guide to using a
It's not really a tool issue. You need your backend to set the refresh token as a http only cookie, store your auth token in a global in memory variable. Then call your refresh end point when your auth token expires, which should read your http cookie, return a new auth token, you replace the in memory one
16 replies
RRefine
Created by correct-apricot on 3/15/2023 in #general
Hello is there any guide to using a
Actually, as we control the API, I'm looking at patching the api to look at cookies for the auth token, then I can set them httponly at the client side and radically simplify the clientside code
16 replies
RRefine
Created by harsh-harlequin on 3/15/2023 in #general
Hello is there any guide to using a
I'm going to refactor my auth based on that article I think, I've sort of put off the refresh bit, but will have to deal with it now
16 replies
RRefine
Created by vicious-gold on 3/15/2023 in #general
Hello is there any guide to using a
Ah that is super interesting, thanks! But why do you need a library etc to handle the global state for a bit of data that you are likely only going to need to set in one place? Global variables aren't that bad if handled correctly also 🙂
16 replies
RRefine
Created by vicious-gold on 3/15/2023 in #general
Hello is there any guide to using a
16 replies
RRefine
Created by generous-apricot on 3/15/2023 in #ask-any-question
Invalidate login when API authentication expires?
It's hacky, I'd rather redraw so I can pass a message. But it will do for now. Any bright ideas about how to do this without reloading very welcome
8 replies
RRefine
Created by crude-lavender on 3/15/2023 in #ask-any-question
Invalidate login when API authentication expires?
Ah! Simply intercepting the error, deleting the local storage and then doing a window.location.reload(); will do nicely
8 replies
RRefine
Created by future-harlequin on 3/15/2023 in #ask-any-question
Invalidate login when API authentication expires?
@kapa.ai I don't think you can use useLogout in an axios interceptor. That looks to be breaking rules of hooks.
8 replies
RRefine
Created by solid-orange on 3/15/2023 in #ask-any-question
Hidden input field?
Cool!
14 replies