fix password reset since going to smtp
This commit is contained in:
@@ -3,7 +3,7 @@ import axios from 'axios'
|
|||||||
// In production, use relative path to hit the proxy
|
// In production, use relative path to hit the proxy
|
||||||
// In development, use the env variable for dev server proxy
|
// In development, use the env variable for dev server proxy
|
||||||
const API_BASE_URL = process.env.NODE_ENV === 'production'
|
const API_BASE_URL = process.env.NODE_ENV === 'production'
|
||||||
? '/api'
|
? ''
|
||||||
: process.env.VUE_APP_API_URL || 'http://127.0.0.1:5000'
|
: process.env.VUE_APP_API_URL || 'http://127.0.0.1:5000'
|
||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
@@ -42,8 +42,8 @@ api.interceptors.response.use(
|
|||||||
|
|
||||||
// Use relative path in production, full URL in development
|
// Use relative path in production, full URL in development
|
||||||
const refreshUrl = process.env.NODE_ENV === 'production'
|
const refreshUrl = process.env.NODE_ENV === 'production'
|
||||||
? '/api/refresh-token'
|
? '/refresh-token'
|
||||||
: `${API_BASE_URL}/api/refresh-token`
|
: `${API_BASE_URL}/refresh-token`
|
||||||
|
|
||||||
const { data } = await axios.post(refreshUrl, {
|
const { data } = await axios.post(refreshUrl, {
|
||||||
refresh_token: refreshToken
|
refresh_token: refreshToken
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
error.value = null
|
error.value = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.post('/api/signup', {
|
const { data } = await api.post('/signup', {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
email,
|
email,
|
||||||
@@ -50,7 +50,7 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
error.value = null
|
error.value = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.post('/api/login', {
|
const { data } = await api.post('/login', {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
})
|
})
|
||||||
@@ -92,7 +92,7 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
error.value = null
|
error.value = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.post('/api/password-reset/request', { email })
|
const { data } = await api.post('/password-reset/request', { email })
|
||||||
return data
|
return data
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error.value = err.response?.data?.error || 'Password reset request failed'
|
error.value = err.response?.data?.error || 'Password reset request failed'
|
||||||
@@ -107,7 +107,7 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
error.value = null
|
error.value = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.post('/api/password-reset/confirm', {
|
const { data } = await api.post('/password-reset/confirm', {
|
||||||
token,
|
token,
|
||||||
new_password: newPassword,
|
new_password: newPassword,
|
||||||
})
|
})
|
||||||
@@ -125,7 +125,7 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
error.value = null
|
error.value = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.get('/api/protected/profile')
|
const { data } = await api.get('/protected/profile')
|
||||||
return data
|
return data
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error.value = err.response?.data?.error || 'Failed to fetch profile'
|
error.value = err.response?.data?.error || 'Failed to fetch profile'
|
||||||
@@ -140,7 +140,7 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
error.value = null
|
error.value = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.put('/api/protected/profile', profileData)
|
const { data } = await api.put('/protected/profile', profileData)
|
||||||
return data
|
return data
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error.value = err.response?.data?.error || 'Failed to update profile'
|
error.value = err.response?.data?.error || 'Failed to update profile'
|
||||||
|
|||||||
Reference in New Issue
Block a user