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