@ -690,7 +690,7 @@
}
try {
await $mod.$vbase .request('POST', '/api/verification/send', {
await $mod.$auth .request('POST', '/api/verification/send', {
type: type,
target: signInForm.target,
purpose: 'login'
@ -729,16 +729,16 @@
}
const type = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(signInForm.target) ? 'email' : 'phone';
const data = await $mod.$vbase .request('POST', '/api/auth/login/code', {
const data = await $mod.$auth .request('POST', '/api/auth/login/code', {
type: type,
target: signInForm.target,
code: signInForm.code
});
if (data & & data.access_token) {
$mod.$vbase .token = data.access_token;
if (data.refresh_token) $mod.$vbase .refreshToken = data.refresh_token;
if (data.user) $mod.$vbase .user = data.user;
$mod.$auth .token = data.access_token;
if (data.refresh_token) $mod.$auth .refreshToken = data.refresh_token;
if (data.user) $mod.$auth .user = data.user;
$message.success($t('auth.login_success'));
if (redirect === '/' || redirect.startsWith('http')) {
@ -755,7 +755,7 @@
throw new Error($t('auth.fill_all_fields'));
}
const success = await $mod.$vbase .login(signInForm.username, signInForm.password);
const success = await $mod.$auth .login(signInForm.username, signInForm.password);
if (success) {
$message.success($t('auth.login_success'));
@ -803,7 +803,7 @@
try {
// Use vbase.request for consistent API handling
const data = await $mod.$vbase .request('POST', '/api/auth/register', {
const data = await $mod.$auth .request('POST', '/api/auth/register', {
username: signUpForm.username,
email: signUpForm.email || undefined,
phone: signUpForm.phone || undefined,
@ -812,12 +812,12 @@
if (data & & data.access_token) {
// Auto login after register using vbase setters
$mod.$vbase .token = data.access_token;
$mod.$auth .token = data.access_token;
if (data.refresh_token) {
$mod.$vbase .refreshToken = data.refresh_token;
$mod.$auth .refreshToken = data.refresh_token;
}
if (data.user) {
$mod.$vbase .user = data.user;
$mod.$auth .user = data.user;
}
$message.success($t('auth.register_success'));