АЕ
axios: {
proxy: true
// baseURL: 'http://127.0.0.1:6500'
},
proxy: {
'/login': 'http://127.0.0.1:6500/auth/',
'/register': 'http://127.0.0.1:6500/auth/',
'/v1': 'http://127.0.0.1:6500/api/',
'/check': 'http://127.0.0.1:6500/auth/'
},
Size: a a a
АЕ
axios: {
proxy: true
// baseURL: 'http://127.0.0.1:6500'
},
proxy: {
'/login': 'http://127.0.0.1:6500/auth/',
'/register': 'http://127.0.0.1:6500/auth/',
'/v1': 'http://127.0.0.1:6500/api/',
'/check': 'http://127.0.0.1:6500/auth/'
},
АЕ
АЕ
АЕ
АЕ
const cookie = process.server ? require('cookieparser') : undefined
async nuxtServerInit ({ dispatch, commit }, { req }) {
console.log('req.headers.cookie: ' + util.inspect(req.headers.cookie))
АЕ
R
async nuxtServerInit({dispatch, getters, commit}, {req}){
const isUserSigned = await dispatch('auth/autoSignin');
if (isUserSigned) {
const url = process.env.NODE_ENV === 'production'
? `https://${req.headers.host}/api/auth/getUserByToken`
: `http://${req.headers.host}/api/auth/getUserByToken`;
try {
const user = await this.$axios.$get(url);
if (user && user.id) {
dispatch('auth/setUser', user);
} else {
dispatch('auth/signout', false);
}
} catch (e) {
dispatch('auth/setUser', null);
dispatch('auth/signout', false);
}
}
}
A
SL
А
А
SL
D
A
A
A
АЕ
FW