-
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.
Merge pull request #50 from OpenLXP/origin/sso
Origin/sso
- Loading branch information
Showing
4 changed files
with
53 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const oneMinute = 60 * 1000; | ||
export const fiveMinutes = 5 * 60 * 1000; | ||
export const tenMinutes = 10 * 60 * 1000; | ||
export const twentyMinutes = 20 * 60 * 1000; | ||
export const thirtyMinutes = 30 * 60 * 1000; | ||
export const fortyFiveMinutes = 45 * 60 * 1000; | ||
export const oneHour = 60 * 60 * 1000; | ||
export const twentyFourHours = 24 * 60 * 60 * 1000; |
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,19 @@ | ||
import { axiosInstance } from '../config/axiosInstance'; | ||
import { ssoURL } from '../config/endpoints'; | ||
import { twentyFourHours } from '../config/timeConstants'; | ||
import { useQuery } from 'react-query'; | ||
|
||
/** | ||
* @description Reaches out to the backend and gets the configuration data required for the application. Valid for 24hrs | ||
*/ | ||
|
||
export function useConfig() { | ||
return useQuery( | ||
'ui-config', | ||
() => axiosInstance.get(ssoURL).then((res) => res.data), | ||
{ | ||
staleTime: twentyFourHours, | ||
cacheTime: twentyFourHours, | ||
} | ||
); | ||
} |
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