fix(program-settings): log into Khanegi via /auth/login like the admin panel
Import was posting to /admin/login without provider=user, so no token came back even with valid credentials. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -717,14 +717,23 @@ export class ProgramSettingsService implements OnModuleInit {
|
||||
if (!apiBase) {
|
||||
throw new BadRequestException('آدرس API نسخه (node_server) تنظیم نشده');
|
||||
}
|
||||
const url = this.joinUrl(apiBase, '/admin/login');
|
||||
// همان مسیر پنل ادمین خانگی: POST /auth/login با provider=user
|
||||
const url = this.joinUrl(apiBase, '/auth/login');
|
||||
try {
|
||||
const { data } = await axios.post(
|
||||
const res = await axios.post(
|
||||
url,
|
||||
{ mobile, password },
|
||||
{ timeout: 25000, validateStatus: () => true },
|
||||
{ provider: 'user', mobile, password },
|
||||
{
|
||||
timeout: 25000,
|
||||
validateStatus: () => true,
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
);
|
||||
if (data?.status === false || data?.success === false) {
|
||||
const data = res.data;
|
||||
if (res.status >= 400 || data?.status === false || data?.success === false) {
|
||||
throw new BadRequestException(
|
||||
this.laravelMessage(data) || 'ورود ادمین خانگی ناموفق بود',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user