mutations.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. export function updateUser(state, newInfo) {
  2. state.user = newInfo
  3. }
  4. export function updateAxiosAuthorization (state, accessToken) {
  5. const tokenType = 'Bearer'
  6. const token = accessToken ? (tokenType + ' ' + accessToken) : null
  7. this.$accessToken = accessToken
  8. if (this.$axios) {
  9. this.$axios.defaults.headers.common.Authorization = token
  10. }
  11. if (this.$apiV1) {
  12. this.$apiV1.defaults.headers.common.Authorization = token
  13. }
  14. if (this.$apiV2) {
  15. this.$apiV2.defaults.headers.common.Authorization = token
  16. }
  17. if (this.$apiWeb) {
  18. this.$apiWeb.defaults.headers.common.Authorization = token
  19. }
  20. }
  21. export function updateAccessToken(state, newInfo) {
  22. state.accessToken = newInfo
  23. }
  24. export function updateRedirectTo(state, newInfo) {
  25. state.redirectTo = newInfo
  26. }
  27. export function setAccessToken() {
  28. // this.$axios.defaults.headers.common.Authorization = 'Bearer ' + newInfo
  29. }
  30. export function updateIncompleteProfile(state, newInfo) {
  31. state.incompleteProfile = newInfo
  32. }
  33. export function updateMyNotSeenNotificationsCount(state, newInfo) {
  34. state.myNotSeenNotificationsCount = newInfo
  35. }