Skip to content

Commit

Permalink
Fix:Runtime error solved (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnanx authored Nov 16, 2024
1 parent 732b993 commit 0e5b35b
Show file tree
Hide file tree
Showing 2 changed files with 2,041 additions and 5,895 deletions.
29 changes: 21 additions & 8 deletions apps/web-admin/src/components/ProtectedRoute.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { useFetch } from '@/hooks/useFetch';
import { useContext } from 'react';
import { account } from '@/contexts/MyContext';
import { useMemo } from 'react';
import { useAlert } from '@/hooks/useAlert';
import axios from 'axios';
import { title } from 'process';

export const ProtectedRoute = ({ children }) => {
const router = useRouter();
Expand Down Expand Up @@ -35,20 +37,31 @@ export const ProtectedRoute = ({ children }) => {
async function postOrg() {
const id = user.sub.substring(6);
const name = user.nickname;
const { data, mystatus } = await post(`/core/organizations`, {}, { id, name });
console.log('created');
if (mystatus === 200) {
const response = await post(`/core/organizations`, {}, { id, name });
if(response){
const { data, mystatus } = response;
console.log('created');
if (mystatus === 200) {
showAlert({
title: 'Success',
description: 'Organization has been created successfully.',
status: 'success',
});
}
}
else{
showAlert({
title: 'Success',
description: 'Organization has been created successfully.',
status: 'success',
});
title:"Authentication Error",
description:"Log out and then sign in again!!"
})
}


}
async function checkOrg() {
const response = await get('/core/users/mycreds');
// console.log(response.data.data);
if (response.status === 200) {
if (response && response.status === 200) {
setAccountDetails((preValue) => {
return {
...preValue,
Expand Down
Loading

0 comments on commit 0e5b35b

Please sign in to comment.