@@ -13,11 +13,7 @@ import {defineSecret} from 'firebase-functions/params';
13
13
import { onInit } from 'firebase-functions/v2/core' ;
14
14
import { SecretParam } from 'firebase-functions/lib/params/types.js' ;
15
15
16
-
17
16
let swisshandballToken : SecretParam | undefined ;
18
- onInit ( ( ) => {
19
- swisshandballToken = defineSecret ( 'SWISSHANDBALL_TOKEN' ) ;
20
- } ) ;
21
17
22
18
export default {
23
19
@@ -87,6 +83,7 @@ async function getTeams(clubId: string) {
87
83
swisshandballToken = defineSecret ( 'SWISSHANDBALL_SH_' + clubId + '_TOKEN' ) ;
88
84
} ) ;
89
85
if ( swisshandballToken ) {
86
+ logger . info ( '>> https://clubapi.handball.ch/rest/v1/clubs/' + clubId + '/teams' ) ;
90
87
// const swisshandballToken = defineSecret('SWISSHANDBALL_SH_' + clubId + '_TOKEN');;
91
88
// eslint-disable-next-line no-undef
92
89
const data = await fetch ( 'https://clubapi.handball.ch/rest/v1/clubs/' + clubId + '/teams' , {
@@ -125,6 +122,7 @@ async function getTeam(teamId: string, clubId: string) {
125
122
swisshandballToken = defineSecret ( 'SWISSHANDBALL_SH_' + clubId + '_TOKEN' ) ;
126
123
} ) ;
127
124
if ( swisshandballToken ) {
125
+ logger . info ( '>> https://clubapi.handball.ch/rest/v1/teams/' + teamId ) ;
128
126
// eslint-disable-next-line no-undef
129
127
const data = await fetch ( 'https://clubapi.handball.ch/rest/v1/teams/' + teamId , {
130
128
headers : { 'Authorization' : 'Basic ' + swisshandballToken ?. value ( ) || '' } ,
@@ -168,10 +166,9 @@ async function getClubs() {
168
166
}
169
167
170
168
async function getClub ( clubId : string ) {
171
- onInit ( ( ) => {
172
- swisshandballToken = defineSecret ( 'SWISSHANDBALL_SH_' + clubId + '_TOKEN' ) ;
173
- } ) ;
169
+ swisshandballToken = defineSecret ( 'SWISSHANDBALL_SH_' + clubId + '_TOKEN' ) ;
174
170
if ( swisshandballToken ) {
171
+ logger . info ( '>> https://clubapi.handball.ch/rest/v1/clubs/' + clubId ) ;
175
172
// eslint-disable-next-line no-undef
176
173
const data = await fetch ( 'https://clubapi.handball.ch/rest/v1/clubs/' + clubId , {
177
174
headers : { 'Authorization' : 'Basic ' + swisshandballToken ?. value ( ) || '' } ,
@@ -198,10 +195,9 @@ async function getClub(clubId: string) {
198
195
199
196
async function getClubGames ( clubId : string ) {
200
197
const gameList = < any > [ ] ;
201
- onInit ( ( ) => {
202
- swisshandballToken = defineSecret ( 'SWISSHANDBALL_SH_' + clubId + '_TOKEN' ) ;
203
- } ) ;
198
+ swisshandballToken = defineSecret ( 'SWISSHANDBALL_SH_' + clubId + '_TOKEN' ) ;
204
199
if ( swisshandballToken ) {
200
+ logger . info ( '>> https://clubapi.handball.ch/rest/v1/clubs/' + clubId + '/games' ) ;
205
201
// eslint-disable-next-line no-undef
206
202
const data = await fetch ( 'https://clubapi.handball.ch/rest/v1/clubs/' + clubId + '/games' , {
207
203
headers : { 'Authorization' : 'Basic ' + swisshandballToken ?. value ( ) || '' } ,
@@ -267,10 +263,9 @@ async function getClubGames(clubId: string) {
267
263
268
264
async function getGames ( teamId : string , clubId : string ) {
269
265
const gameList = < any > [ ] ;
270
- onInit ( ( ) => {
271
- swisshandballToken = defineSecret ( 'SWISSHANDBALL_SH_' + clubId + '_TOKEN' ) ;
272
- } ) ;
266
+ swisshandballToken = defineSecret ( 'SWISSHANDBALL_SH_' + clubId + '_TOKEN' ) ;
273
267
if ( swisshandballToken ) {
268
+ logger . info ( '>> https://clubapi.handball.ch/rest/v1/teams/' + teamId + '/games' ) ;
274
269
// eslint-disable-next-line no-undef
275
270
const data = await fetch ( 'https://clubapi.handball.ch/rest/v1/teams/' + teamId + '/games' , {
276
271
headers : { 'Authorization' : 'Basic ' + swisshandballToken ?. value ( ) || '' } ,
@@ -336,10 +331,9 @@ async function getGames(teamId: string, clubId: string) {
336
331
337
332
async function getRankings ( teamId : string , clubId : string ) {
338
333
const rankingList = < any > [ ] ;
339
- onInit ( ( ) => {
340
- swisshandballToken = defineSecret ( 'SWISSHANDBALL_SH_' + clubId + '_TOKEN' ) ;
341
- } ) ;
334
+ swisshandballToken = defineSecret ( 'SWISSHANDBALL_SH_' + clubId + '_TOKEN' ) ;
342
335
if ( swisshandballToken ) {
336
+ logger . info ( '>> https://clubapi.handball.ch/rest/v1/teams/' + teamId + '/group' ) ;
343
337
// eslint-disable-next-line no-undef
344
338
const data = await fetch ( 'https://clubapi.handball.ch/rest/v1/teams/' + teamId + '/group' , {
345
339
headers : { 'Authorization' : 'Basic ' + swisshandballToken ?. value ( ) || '' } ,
0 commit comments