-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert til gamle arbeidssøkerregistret (#144)"
This reverts commit c291876.
- Loading branch information
1 parent
c291876
commit 4535f16
Showing
8 changed files
with
59 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 25 additions & 14 deletions
39
src/components/arbeidssoker-status/ArbeidssokerStatus.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,44 @@ | ||
import useSWR from "swr"; | ||
import { useSanity } from "../../context/sanity-context"; | ||
import { Alert } from "@navikt/ds-react"; | ||
import { Alert, Skeleton } from "@navikt/ds-react"; | ||
import { PortableText } from "@portabletext/react"; | ||
import styles from "./ArbeidssokerStatus.module.css"; | ||
|
||
export function ArbeidssokerStatus() { | ||
const { data: registrering, error } = useSWR( | ||
const { data, error, isLoading } = useSWR( | ||
`${process.env.NEXT_PUBLIC_BASE_PATH}/api/arbeidssoker/perioder`, | ||
); | ||
|
||
const registered = data?.findIndex((periode) => periode.avsluttet === null) !== -1; | ||
const { getRichText } = useSanity(); | ||
|
||
if (registrering === undefined && !error) { | ||
return null; | ||
if (isLoading) { | ||
return ( | ||
<div style={{ fontSize: "7rem" }}> | ||
<Skeleton variant="text" width="100%" /> | ||
</div> | ||
); | ||
} | ||
|
||
if (error || typeof registrering.arbeidssokerperioder === "undefined") { | ||
return <PortableText value={getRichText("arbeidssokers-status.fant-ikke-svaret")} />; | ||
if (!isLoading && error) { | ||
return ( | ||
<Alert variant="warning" className={styles.arbeidssokerStatusNotRegisteredAlertBox}> | ||
<PortableText value={getRichText("arbeidssokers-status.teknisk-feil")} /> | ||
</Alert> | ||
); | ||
} | ||
|
||
const isRegistered = registrering.arbeidssokerperioder.length; | ||
|
||
if (!isRegistered) { | ||
if (!isLoading && !error && !registered) { | ||
return ( | ||
<div className={styles.arbeidssokerStatusContainer}> | ||
<Alert variant="warning" className={styles.arbeidssokerStatusNotRegisteredAlertBox}> | ||
<PortableText value={getRichText("arbeidssokers-status.er-ikke-registrert")} /> | ||
</Alert> | ||
</div> | ||
<Alert variant="warning" className={styles.arbeidssokerStatusNotRegisteredAlertBox}> | ||
<PortableText value={getRichText("arbeidssokers-status.er-ikke-registrert")} /> | ||
</Alert> | ||
); | ||
} | ||
|
||
return ( | ||
<div className={styles.arbeidssokerStatusContainer}> | ||
<PortableText value={getRichText("arbeidssokers-status.er-registrert")} /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const innsynAudience = `${process.env.NAIS_CLUSTER_NAME}:teamdagpenger:dp-innsyn`; | ||
export const safAudience = `${process.env.SAF_SELVBETJENING_CLUSTER}:teamdokumenthandtering:${process.env.SAF_SELVBETJENING_SCOPE}`; | ||
export const veilarbAudience = `${process.env.NAIS_CLUSTER_NAME}:paw:veilarbregistrering`; | ||
export const audienceArbeidsoekkerregisteret = `${process.env.NAIS_CLUSTER_NAME}:paw:paw-arbeidssoekerregisteret-api-oppslag`; | ||
export const kontoregisterAudience = `${process.env.NAIS_CLUSTER_NAME}:okonomi:sokos-kontoregister-person`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters