Skip to content
Snippets Groups Projects
Commit 1e203e9f authored by Muthukrishnanmatriot's avatar Muthukrishnanmatriot
Browse files

TMSS-937 - Updated header content-type

parent 11c63128
Branches
Tags
2 merge requests!634WIP: COBALT commissioning delta,!577Resolves TMSS-937
...@@ -25,9 +25,10 @@ const AuthService = { ...@@ -25,9 +25,10 @@ const AuthService = {
} }
}, },
deAuthenticate: async(token) => { deAuthenticate: async(token) => {
let contentType = '';
try { try {
const loginType = localStorage.getItem("loginType"); const loginType = localStorage.getItem("loginType");
if (loginType && loginType === 'Application') { if (loginType && loginType !== 'Application') {
await axios.delete("/api/token-deauth/"); await axios.delete("/api/token-deauth/");
} else { } else {
let token = ''; let token = '';
...@@ -36,12 +37,17 @@ const AuthService = { ...@@ -36,12 +37,17 @@ const AuthService = {
user = JSON.parse(user); user = JSON.parse(user);
token = user.token; token = user.token;
} }
await axios.post(UIConstants.KEYCLOAK_LOGOUT_URL, {csrfmiddlewaretoken:token}); contentType = axios.defaults.headers.common['Content-Type'];
const formData = 'csrfmiddlewaretoken='+token;
await axios.post(UIConstants.KEYCLOAK_LOGOUT_URL, formData, {headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
}});
} }
localStorage.removeItem("loginType"); localStorage.removeItem("loginType");
} catch(error) { } catch(error) {
console.error(error); console.error(error);
} }
axios.defaults.headers.common['Content-Type'] = contentType;
}, },
isValidToken: async(token) => { isValidToken: async(token) => {
try { try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment