-
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.
✨ #459 - feat: add frontend permission check for updating reviewer
- Loading branch information
1 parent
ac369fe
commit 0db343e
Showing
4 changed files
with
64 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useAlert } from "@maykin-ui/admin-ui"; | ||
import { useEffect, useState } from "react"; | ||
|
||
import { User, whoAmI } from "../lib/api/auth"; | ||
|
||
/** | ||
* Hook resolving the current user | ||
*/ | ||
export function useWhoAmI(): User | null { | ||
const alert = useAlert(); | ||
|
||
const [valueState, setValueState] = useState<ReturnType< | ||
typeof useWhoAmI | ||
> | null>(null); | ||
useEffect(() => { | ||
whoAmI() | ||
.then((value) => setValueState(value)) | ||
.catch((e) => { | ||
console.error(e); | ||
alert( | ||
"Foutmelding", | ||
"Er is een fout opgetreden bij het ophalen van de huidige gebruiker!", | ||
"Ok", | ||
); | ||
}); | ||
}, []); | ||
|
||
return valueState; | ||
} |
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