Skip to content

Commit

Permalink
Changed flagsmith to cloud version (#141)
Browse files Browse the repository at this point in the history
* Style: fixed odia title (#104)

* style: ui scroll bug on faq page

* style: fixed odia title

* Feat chat history (#106)

fix: token authentication

* Delete .env.production

* UI changes (#112)

* style: minor ui changes

* fix: delete history page fix and flagsmith self hoasted added

---------

Co-authored-by: Prateek Jakhar <[email protected]>

* fix: conversation id (#115)

* fix: conversation id

* Added down time page (#117)

* Update ContextProvider.tsx (#118)

* Feat dialer popup (#120)

* added down time page

* Update chat.tsx

* Added Auth header (#122)



* added down time page

* added dialer popup

* added auth in headers

* Update chat.tsx

* chore: msgId display for testing (#127)

* chore: msgId display for testing

* Feat dsply msg (#128)

* fix: history not loading on refresh

* chore: fixed userID bug (#130)

* Feat fcm (#133)

* feat: added fcm

---------

Co-authored-by: Saiyan Abhishek <[email protected]>

* fix: update in conversation api (#135)

* fix: added firebase event for msg delay (#136)

* fix: flagsmith init inside useeffect (#140)

* fix: flagsmith init inside useeffect

* added flagsmith cloud

---------

Co-authored-by: Prateek Jakhar <[email protected]>

---------

Co-authored-by: Saiyan Abhishek <[email protected]>
  • Loading branch information
prtkjakhar and geeky-abhishek authored Jun 1, 2023
1 parent ae6d95e commit c02f28a
Showing 1 changed file with 35 additions and 10 deletions.
45 changes: 35 additions & 10 deletions apps/amakrushi/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,42 @@ function SafeHydrate({ children }: { children: ReactElement }) {
const App = ({
Component,
pageProps,
flagsmithState,
}: AppProps & { flagsmithState: any }) => {
}: AppProps) => {

const router = useRouter();
const { isAuthenticated, login } = useLogin();
const [launch, setLaunch] = useState(true);
const [cookie, setCookie, removeCookie] = useCookies();

const [flagsmithState, setflagsmithState] = useState(null)



useEffect(() => {
setTimeout(() => {
setLaunch(false);
}, 2500);
}, []);


useEffect(() =>{
const getFlagSmithState =async ()=>{
await flagsmith.init({
// api: process.env.NEXT_PUBLIC_FLAGSMITH_API,
environmentID: process.env.NEXT_PUBLIC_ENVIRONMENT_ID || '',
})
if(flagsmith.getState())
{
//@ts-ignore
setflagsmithState(flagsmith.getState())
}
}
getFlagSmithState()

},[])



const handleLoginRedirect = useCallback(() => {
if (router.pathname === '/login' || router.pathname.startsWith('/otp')) {
// already logged in then send to home
Expand Down Expand Up @@ -125,7 +148,7 @@ const App = ({
globalThis.console.log = () => {};
}

if (launch) {
if (launch || !flagsmithState) {
return <LaunchPage />;
} else {
return (
Expand All @@ -147,11 +170,13 @@ const App = ({
}
};

App.getInitialProps = async () => {
await flagsmith.init({
api: process.env.NEXT_PUBLIC_FLAGSMITH_API,
environmentID: process.env.NEXT_PUBLIC_ENVIRONMENT_ID,
});
return { flagsmithState: flagsmith.getState() };
};
// App.getInitialProps = async () => {
// await flagsmith.init({
// api: process.env.NEXT_PUBLIC_FLAGSMITH_API,
// environmentID: process.env.NEXT_PUBLIC_ENVIRONMENT_ID,
// });
// return { flagsmithState: flagsmith.getState() };
// };


export default App;

1 comment on commit c02f28a

@vercel
Copy link

@vercel vercel bot commented on c02f28a Jun 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.