Skip to content

Commit

Permalink
fix(firebase): correct redirect url
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitMY committed Oct 22, 2023
1 parent 1e54684 commit 6345ec2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion functions/src/text-normalization/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ export class TextNormalizationEndpoint {
export const textNormalizationFunctions = (database: FirebaseDatabase) => {
const openAIKey = defineString('OPENAI_API_KEY');
const endpoint = new TextNormalizationEndpoint(database, openAIKey);
const request = endpoint.request.bind(endpoint);

const app = express();
app.use(cors());
app.options('*', (req, res) => res.status(200).end());
app.get('/', endpoint.request.bind(endpoint));
app.get('/', request);
app.get('/api/text-normalization', request); // Hosting redirect
app.use(errorMiddleware);
return onRequest({enforceAppCheck: true}, app);
};
3 changes: 1 addition & 2 deletions src/app/modules/translate/translate.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ export class TranslationService {
const params = new URLSearchParams();
params.set('lang', language);
params.set('text', text);
// TODO change URL to https://sign.mt/api/text-normalization/ when deployed
const url = 'https://translate-textnormalization-sxie2r74ua-uc.a.run.app/?' + params.toString();
const url = 'https://sign.mt/api/text-normalization?' + params.toString();

const appCheckToken = await AppCheck.getToken();
const headers = {'X-AppCheck-Token': appCheckToken};
Expand Down

0 comments on commit 6345ec2

Please sign in to comment.