Skip to content

Commit

Permalink
Use lower case paths in server routes and dev ytelse page
Browse files Browse the repository at this point in the history
  • Loading branch information
cskrov committed Nov 1, 2024
1 parent 8cb9695 commit 0035f22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion server/src/innsendingsytelser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ enum Innsendingsytelse {
YTELSER_TIL_TIDLIGERE_FAMILIEPLEIERE = 'YTELSER_TIL_TIDLIGERE_FAMILIEPLEIERE',
}

export const INNSENDINGSYTELSER = Object.values(Innsendingsytelse);
const INNSENDINGSYTELSER = Object.values(Innsendingsytelse);
export const LOWER_CASE_INNSENDINGSYTELSER = INNSENDINGSYTELSER.map((ytelse) => ytelse.toLowerCase());
6 changes: 3 additions & 3 deletions server/src/plugins/not-found.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { YTELSE_OVERVIEW_URL, isDeployedToProd } from '@app/config/env';
import { INNSENDINGSYTELSER } from '@app/innsendingsytelser';
import { LOWER_CASE_INNSENDINGSYTELSER } from '@app/innsendingsytelser';
import { getLogger } from '@app/logger';
import { externalRedirectCounter } from '@app/plugins/serve-index/counters';
import { removeSaksnummer } from '@app/plugins/serve-index/remove-saksnummer';
Expand Down Expand Up @@ -42,8 +42,8 @@ const getCells = (ytelse: string): string[] =>
const createCell = (path: string, type: string) => `<td class="path"><a href="${path}">${type}</a></td>`;

const getRows = (): string[][] =>
INNSENDINGSYTELSER.map((ytelse) => [
`<td class="ytelse">${ytelse.toLowerCase().replaceAll('_', ' ')}</td>`,
LOWER_CASE_INNSENDINGSYTELSER.map((ytelse) => [
`<td class="ytelse">${ytelse.replaceAll('_', ' ')}</td>`,
...getCells(ytelse),
]);

Expand Down
4 changes: 2 additions & 2 deletions server/src/plugins/serve-index/get-paths.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { INNSENDINGSYTELSER } from '@app/innsendingsytelser';
import { LOWER_CASE_INNSENDINGSYTELSER } from '@app/innsendingsytelser';
import { CASE_TYPES, LANGUAGES, LOGGED_IN_STEPS, STEPS } from '@app/plugins/serve-index/segments';

export const getAnonymousPaths = (): string[] => {
const paths: string[] = [];

for (const lang of LANGUAGES) {
for (const type of CASE_TYPES) {
for (const ytelse of INNSENDINGSYTELSER) {
for (const ytelse of LOWER_CASE_INNSENDINGSYTELSER) {
paths.push(`/${lang}/${type}/${ytelse}`);
paths.push(`/${lang}/ettersendelse/${type}/${ytelse}`);

Expand Down

0 comments on commit 0035f22

Please sign in to comment.