forked from verdnatura/salix-front
refs #6930 feat: call loutMultimedia endpoint
This commit is contained in:
parent
bddfe8f9d7
commit
0d80fd37a4
|
@ -11,7 +11,7 @@ axios.defaults.baseURL = '/api/';
|
|||
|
||||
const onRequest = (config) => {
|
||||
const token = session.getToken();
|
||||
if (token.length && config.headers) {
|
||||
if (token.length && !config.headers.Authorization) {
|
||||
config.headers.Authorization = token;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { useState } from './useState';
|
||||
import { useRole } from './useRole';
|
||||
import { useUserConfig } from './useUserConfig';
|
||||
import axios from 'axios';
|
||||
|
||||
|
||||
export function useSession() {
|
||||
|
@ -27,15 +28,37 @@ export function useSession() {
|
|||
}
|
||||
}
|
||||
|
||||
function destroy() {
|
||||
if (localStorage.getItem('token'))
|
||||
localStorage.removeItem('token')
|
||||
|
||||
if (localStorage.getItem('tokenMultimedia'))
|
||||
async function destroy() {
|
||||
if (localStorage.getItem('tokenMultimedia')){
|
||||
await axios.post('VnUsers/logoutMultimedia', null, {
|
||||
headers: {Authorization: localStorage.getItem('tokenMultimedia') }
|
||||
});
|
||||
localStorage.removeItem('tokenMultimedia')
|
||||
|
||||
if (sessionStorage.getItem('token'))
|
||||
sessionStorage.removeItem('token');
|
||||
}
|
||||
if (localStorage.getItem('token')){
|
||||
await axios.post('VnUsers/logout', null, {
|
||||
headers: {Authorization: localStorage.getItem('token') }
|
||||
});
|
||||
localStorage.removeItem('token')
|
||||
}
|
||||
|
||||
|
||||
if (sessionStorage.getItem('tokenMultimedia')){
|
||||
await axios.post('VnUsers/logoutMultimedia', null, {
|
||||
headers: {Authorization: sessionStorage.getItem('tokenMultimedia') }
|
||||
});
|
||||
sessionStorage.removeItem('tokenMultimedia')
|
||||
|
||||
}
|
||||
if (sessionStorage.getItem('token')){
|
||||
await axios.post('VnUsers/logout', null, {
|
||||
headers: {Authorization: sessionStorage.getItem('token') }
|
||||
});
|
||||
sessionStorage.removeItem('token')
|
||||
}
|
||||
|
||||
|
||||
|
||||
const { setUser } = useState();
|
||||
|
||||
|
|
Loading…
Reference in New Issue