Skip to content

Commit

Permalink
Merge branch 'fix/start-token' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldemylla committed Oct 30, 2023
2 parents a889f44 + be86885 commit cb20e42
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
21 changes: 16 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
<script>
import { mapState } from 'vuex';
import http from '@/services/api/http';
import env from '@/utils/env';
import { sendWindowNotification } from '@/utils/notifications';
import { WS } from '@/services/api/socket';
import Profile from '@/services/api/resources/profile';
import { getToken } from './utils/config';
import { PREFERENCES_SOUND } from './components/PreferencesBar.vue';
const moment = require('moment');
Expand Down Expand Up @@ -39,20 +43,27 @@ class Notification {
export default {
name: 'App',
created() {
async beforeMount() {
http.interceptors.request.use((config) => {
// eslint-disable-next-line no-param-reassign
config.headers.Authorization = `Bearer ${getToken()}`;
return config;
});
this.handleLocale();
setInterval(this.intervalPing, this.timerPing);
const localStorageStatus = localStorage.getItem('statusAgent');
if (!localStorageStatus || localStorageStatus === 'None') {
localStorage.setItem('statusAgent', 'OFFLINE');
}
this.getStatus();
},
async beforeMount() {
async mounted() {
await this.getUser();
await this.loadQuickMessages();
await this.loadQuickMessagesShared();
this.getStatus();
this.loadQuickMessages();
this.loadQuickMessagesShared();
},
data() {
Expand Down
7 changes: 0 additions & 7 deletions src/services/api/http.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import axios from 'axios';
import env from '@/utils/env';
import { getToken } from '@/utils/config';

const isProduction = process.env.NODE_ENV === 'production';
const protocol = isProduction ? 'https' : 'https';
Expand All @@ -9,10 +8,4 @@ const client = axios.create({
baseURL: `${protocol}://${env('CHATS_API_URL')}/v1`,
});

client.interceptors.request.use((config) => {
// eslint-disable-next-line no-param-reassign
config.headers.Authorization = `Bearer ${getToken()}`;
return config;
});

export default client;

0 comments on commit cb20e42

Please sign in to comment.