Browse Source

fix: user info api call correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1697/head
Pranav C 3 years ago
parent
commit
5b7c12023d
  1. 12
      packages/nc-gui/store/users.js

12
packages/nc-gui/store/users.js

@ -153,7 +153,7 @@ export const actions = {
setInterval(async() => { setInterval(async() => {
if (getters.GtrUser) { if (getters.GtrUser) {
try { try {
const res = await this.$api.auth.me() // this.$axios.get('/user/me') const res = await this.$api.auth.me()
if (res === null || !res.email) { if (res === null || !res.email) {
commit('MutSetUser', null) commit('MutSetUser', null)
} else { } else {
@ -239,7 +239,6 @@ export const actions = {
// console.log('in action signin'); // console.log('in action signin');
let err = null let err = null
try { try {
const userPromise = await this.$api.auth.signin(data) const userPromise = await this.$api.auth.signin(data)
commit('MutSetToken', userPromise.token) commit('MutSetToken', userPromise.token)
@ -272,7 +271,7 @@ export const actions = {
async ActGetUserDetails({ commit, state }) { async ActGetUserDetails({ commit, state }) {
try { try {
const user = await this.$api.auth.me({ // await this.$axios.get('/user/me', { const user = await this.$api.auth.me({}, {
headers: { headers: {
'xc-auth': state.token 'xc-auth': state.token
} }
@ -285,11 +284,10 @@ export const actions = {
async ActGetProjectUserDetails({ commit, state }, projectId) { async ActGetProjectUserDetails({ commit, state }, projectId) {
try { try {
const user = await this.$api.auth.me({ // '/user/me?project_id=' + projectId, { const user = await this.$api.auth.me({ project_id: projectId }, {
headers: { headers: {
'xc-auth': state.token 'xc-auth': state.token
}, }
query: { project_id: projectId }
}) })
commit('MutProjectRole', user && user.roles) commit('MutProjectRole', user && user.roles)
} catch (e) { } catch (e) {
@ -299,7 +297,7 @@ export const actions = {
async ActGetBaseUserDetails({ commit, state }, sharedBaseId) { async ActGetBaseUserDetails({ commit, state }, sharedBaseId) {
try { try {
try { try {
const user = await this.$api.auth.me({ // '/user/me', { const user = await this.$api.auth.me({}, {
headers: { headers: {
'xc-shared-base-id': sharedBaseId 'xc-shared-base-id': sharedBaseId
} }

Loading…
Cancel
Save