-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix: Red flag of user creation * Removed redundant calls to /users/me * Fix: Role based Authentication data check * Fix: Removed redundance API calls during route change in dashboard * Fix: Fixed appropriate route changes * Fix: Fixed API Call fetch during sign up and removed console.logs --------- Co-authored-by: krishnanx <[email protected]>
- Loading branch information
Showing
39 changed files
with
354 additions
and
10,934 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
images: { | ||
domains: ['s.gravatar.com', 'cdn.auth0.com'], // Add all allowed domains here | ||
}, | ||
}; | ||
|
||
module.exports = nextConfig; |
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,57 @@ | ||
import React, { createContext, useState, useEffect } from 'react'; | ||
import { useFetch } from '@/hooks/useFetch'; | ||
import { useAlert } from '@/hooks/useAlert'; | ||
import { useAuth0 } from '@auth0/auth0-react'; | ||
export const account = createContext(); | ||
const MyContext = ({ children }) => { | ||
const [accountDetails, setAccountDetails] = useState({}); | ||
const { user, isAuthenticated, isLoading, loginWithRedirect } = useAuth0(); | ||
const { loading, get, put } = useFetch(); | ||
const showAlert = useAlert(); | ||
useEffect(() => { | ||
const fetchAccountDetails = async () => { | ||
if (isAuthenticated) { | ||
const { data, status } = await get('/core/users/me'); | ||
const response = await get('/core/users/mycreds'); | ||
// console.log(response, data); | ||
setAccountDetails((preValue) => ({ ...preValue, ...(data.accountDetails || {}) })); | ||
} | ||
}; | ||
fetchAccountDetails(); | ||
// console.log('trigger'); | ||
}, [isAuthenticated]); | ||
|
||
const updateAccountDetails = async () => { | ||
const { data, status } = await put('/core/users/me', {}, accountDetails); | ||
// console.log(data); | ||
if (status === 200) { | ||
showAlert({ | ||
title: 'Success', | ||
description: 'Account details updated successfully.', | ||
status: 'success', | ||
}); | ||
console.log(data); | ||
setAccountDetails((prev) => { | ||
return { | ||
...prev, | ||
...(data.accountDetails || {}), | ||
}; | ||
}); | ||
} else { | ||
showAlert({ | ||
title: 'Error', | ||
description: data.error, | ||
status: 'error', | ||
}); | ||
} | ||
}; | ||
return ( | ||
<div> | ||
<account.Provider value={{ accountDetails, setAccountDetails, updateAccountDetails }}> | ||
{children} | ||
</account.Provider> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MyContext; |
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
File renamed without changes.
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
Oops, something went wrong.