Send language when fetching available tasks

This commit is contained in:
AbdBarho
2023-01-22 21:57:21 +01:00
parent b8672e5986
commit 51afea69ec
5 changed files with 28 additions and 10 deletions
+2 -2
View File
@@ -269,8 +269,8 @@ export class OasstApiClient {
/**
* Returns the counts of all tasks (some might be zero)
*/
async fetch_available_tasks(user: BackendUserCore): Promise<AvailableTasks> {
return this.post(`/api/v1/tasks/availability`, user);
async fetch_available_tasks(user: BackendUserCore, lang: string): Promise<AvailableTasks> {
return this.post(`/api/v1/tasks/availability`, { ...user, lang });
}
}
+1 -1
View File
@@ -15,7 +15,7 @@ const LOCALE_SET = new Set(i18n.locales);
* the i18n module.
* 3. "en" as a final fallback.
*/
const getUserLanguage = (req: NextApiRequest) => {
const getUserLanguage = (req: NextApiRequest): string => {
const cookieLanguage = req.cookies["NEXT_LOCALE"];
if (cookieLanguage) {
return cookieLanguage;