api change
This commit is contained in:
@@ -18,6 +18,14 @@ export const QR_VITANOVA_API = isDevMode()
|
||||
? '/proxy/qr-vitanova/api'
|
||||
: 'https://qr.vitanova.network/api';
|
||||
|
||||
/**
|
||||
* Base URL for API.VITANOVA.NETWORK.
|
||||
* Used for partner authorization check: GET /partners/{partnerID}
|
||||
*/
|
||||
export const API_VITANOVA_NETWORK = isDevMode()
|
||||
? '/proxy/api-vitanova'
|
||||
: 'https://api.vitanova.network';
|
||||
|
||||
/**
|
||||
* Base URL for the public fastcheck.store API.
|
||||
* Used for /api/fastcheck/settings/{id} and /api/fastcheck/message/{tgId}.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { FastcheckService } from '../../fastcheck.service';
|
||||
import { FASTCHECK_API, FASTCHECK_STORE_API, QR_VITANOVA_API } from '../../api';
|
||||
import { API_VITANOVA_NETWORK, FASTCHECK_API, FASTCHECK_STORE_API, QR_VITANOVA_API } from '../../api';
|
||||
import { TranslatePipe } from '../../translate/translate.pipe';
|
||||
import { TranslationService } from '../../translate/translation.service';
|
||||
|
||||
@@ -304,9 +304,31 @@ export class FastcheckPage {
|
||||
|
||||
createNewFastcheck(event: Event): void {
|
||||
event.preventDefault();
|
||||
this.isNewFlow.set(true);
|
||||
this.loginOnly.set(false);
|
||||
this.openPopup();
|
||||
|
||||
const id = this.partnerId() || this.defaultPartnerId;
|
||||
const sessionId = this.sessionToken();
|
||||
const headers: Record<string, string> = {
|
||||
Authorization: JSON.stringify({ sessionID: sessionId, partnerID: id })
|
||||
};
|
||||
|
||||
this.http
|
||||
.get(`${API_VITANOVA_NETWORK}/partners/${encodeURIComponent(id)}`, { headers })
|
||||
.subscribe({
|
||||
next: () => {
|
||||
// Authorized partner: skip Telegram auth popup and go directly.
|
||||
this.isNewFlow.set(true);
|
||||
this.loginOnly.set(false);
|
||||
this.doRedirectToNew();
|
||||
},
|
||||
error: () => {
|
||||
// Not authorized: force fresh Telegram auth QR popup.
|
||||
this.sessionToken.set('');
|
||||
localStorage.removeItem('fc_session');
|
||||
this.isNewFlow.set(true);
|
||||
this.loginOnly.set(false);
|
||||
this.openPopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private doRedirectToNew(): void {
|
||||
|
||||
Reference in New Issue
Block a user