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