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
import usePlayerStore from '../hooks/use-player-store/use-player-store'; | |
import { useCallback } from 'react'; | |
export function UsePlayer() { | |
const { audio, setAudio, state, setState, updateTime, updateDuration } = | |
usePlayerStore(); | |
const preLoad = useCallback( | |
(url: string) => { |
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
/** | |
* @param {Promise<T>} promise | |
*/ | |
export const resolvePromise = async <T>(promise: Promise<T>) => { | |
try { | |
const data = await promise; | |
return [data, null] as const; | |
} catch (error) { | |
return [null, error] as const; | |
} |
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
import Axios, { AxiosRequestConfig } from 'axios'; | |
import { resolveErrorBackEnd, resolvePromise } from '../ErrorHandler'; | |
const someApiCall = async () => { | |
const requestConfig: AxiosRequestConfig = { | |
headers: { | |
Authorization: ``, | |
}, | |
}; | |
const [data, error] = await resolvePromise<PaginatedConversation>( |
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
# KEYCLOAK BASE URL | |
KEYCLOAK_BASE_URL= | |
# KEYCLOAK CLIENT SECRET | |
KEYCLOAK_CLIENT_SECRET= | |
# KEYCLOAK CLIENT ID | |
KEYCLOAK_CLIENT_ID= | |
# BASE URL FOR NEXT AUTH |