Commit 10b4b96a authored by tom's avatar tom Committed by tom goriunov

do logout from rewards service only if token is preset

parent 3a400a12
...@@ -34,11 +34,13 @@ export default function useLogout() { ...@@ -34,11 +34,13 @@ export default function useLogout() {
if (config.features.rewards.isEnabled) { if (config.features.rewards.isEnabled) {
const rewardsToken = cookies.get(cookies.NAMES.REWARDS_API_TOKEN); const rewardsToken = cookies.get(cookies.NAMES.REWARDS_API_TOKEN);
await apiFetch('rewards_logout', { fetchParams: { if (rewardsToken) {
method: 'POST', await apiFetch('rewards_logout', { fetchParams: {
headers: { Authorization: `Bearer ${ rewardsToken }` }, method: 'POST',
} }); headers: { Authorization: `Bearer ${ rewardsToken }` },
cookies.remove(cookies.NAMES.REWARDS_API_TOKEN); } });
cookies.remove(cookies.NAMES.REWARDS_API_TOKEN);
}
} }
queryClient.resetQueries({ queryClient.resetQueries({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment