api change
This commit is contained in:
@@ -12,5 +12,12 @@
|
|||||||
"changeOrigin": true,
|
"changeOrigin": true,
|
||||||
"pathRewrite": { "^/proxy/qr-vitanova": "" },
|
"pathRewrite": { "^/proxy/qr-vitanova": "" },
|
||||||
"logLevel": "debug"
|
"logLevel": "debug"
|
||||||
|
},
|
||||||
|
"/proxy/api-vitanova": {
|
||||||
|
"target": "https://api.vitanova.network",
|
||||||
|
"secure": true,
|
||||||
|
"changeOrigin": true,
|
||||||
|
"pathRewrite": { "^/proxy/api-vitanova": "" },
|
||||||
|
"logLevel": "debug"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ export const QR_VITANOVA_API = isDevMode()
|
|||||||
? '/proxy/qr-vitanova/api'
|
? '/proxy/qr-vitanova/api'
|
||||||
: 'https://qr.vitanova.network/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.
|
* Base URL for the public fastcheck.store API.
|
||||||
* Used for /api/fastcheck/settings/{id} and /api/fastcheck/message/{tgId}.
|
* Used for /api/fastcheck/settings/{id} and /api/fastcheck/message/{tgId}.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { FastcheckService } from '../../fastcheck.service';
|
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 { TranslatePipe } from '../../translate/translate.pipe';
|
||||||
import { TranslationService } from '../../translate/translation.service';
|
import { TranslationService } from '../../translate/translation.service';
|
||||||
|
|
||||||
@@ -304,10 +304,32 @@ export class FastcheckPage {
|
|||||||
|
|
||||||
createNewFastcheck(event: Event): void {
|
createNewFastcheck(event: Event): void {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
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.isNewFlow.set(true);
|
||||||
this.loginOnly.set(false);
|
this.loginOnly.set(false);
|
||||||
this.openPopup();
|
this.openPopup();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private doRedirectToNew(): void {
|
private doRedirectToNew(): void {
|
||||||
const tok = this.webSessionId();
|
const tok = this.webSessionId();
|
||||||
|
|||||||
Reference in New Issue
Block a user