Skip to content

Commit

Permalink
Revert "Fix:Runtime error solved (#539)" (#540)
Browse files Browse the repository at this point in the history
This reverts commit 0e5b35b.
  • Loading branch information
subru-37 authored Nov 16, 2024
1 parent 0e5b35b commit e56a6ef
Show file tree
Hide file tree
Showing 2 changed files with 5,895 additions and 2,041 deletions.
29 changes: 8 additions & 21 deletions apps/web-admin/src/components/ProtectedRoute.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ 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 @@ -37,31 +35,20 @@ export const ProtectedRoute = ({ children }) => {
async function postOrg() {
const id = user.sub.substring(6);
const name = user.nickname;
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{
const { data, mystatus } = await post(`/core/organizations`, {}, { id, name });
console.log('created');
if (mystatus === 200) {
showAlert({
title:"Authentication Error",
description:"Log out and then sign in again!!"
})
title: 'Success',
description: 'Organization has been created successfully.',
status: 'success',
});
}


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

0 comments on commit e56a6ef

Please sign in to comment.