initialize planets to be empty on login or refresh
This commit is contained in:
@@ -108,7 +108,10 @@ const Home = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const restoreCharacters = (characters: AccessToken[]) => {
|
const restoreCharacters = (characters: AccessToken[]) => {
|
||||||
refreshSession(characters).then(saveCharacters).then(setCharacters);
|
refreshSession(characters)
|
||||||
|
.then(saveCharacters)
|
||||||
|
.then(initializeCharacterPlanets)
|
||||||
|
.then(setCharacters);
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleCompactMode = () => {
|
const toggleCompactMode = () => {
|
||||||
@@ -182,7 +185,10 @@ const Home = () => {
|
|||||||
const ESI_CACHE_TIME_MS = 600000;
|
const ESI_CACHE_TIME_MS = 600000;
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
const characters = initializeCharacters();
|
const characters = initializeCharacters();
|
||||||
refreshSession(characters).then(saveCharacters).then(setCharacters);
|
refreshSession(characters)
|
||||||
|
.then(saveCharacters)
|
||||||
|
.then(initializeCharacterPlanets)
|
||||||
|
.then(setCharacters);
|
||||||
}, ESI_CACHE_TIME_MS);
|
}, ESI_CACHE_TIME_MS);
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
});
|
});
|
||||||
|
@@ -48,6 +48,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
account: accessToken.account,
|
account: accessToken.account,
|
||||||
comment: accessToken.comment,
|
comment: accessToken.comment,
|
||||||
system: accessToken.system,
|
system: accessToken.system,
|
||||||
|
planets: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("Refresh", character.name, character.characterId);
|
console.log("Refresh", character.name, character.characterId);
|
||||||
|
@@ -49,6 +49,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
account: "-",
|
account: "-",
|
||||||
comment: "",
|
comment: "",
|
||||||
system: "",
|
system: "",
|
||||||
|
planets: [],
|
||||||
};
|
};
|
||||||
res.json(token);
|
res.json(token);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user