Skip to content

Commit

Permalink
fix: only fetch organization if logged
Browse files Browse the repository at this point in the history
  • Loading branch information
NiiMiyo committed Nov 9, 2023
1 parent 375de42 commit 28b9f68
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/contexts/Auth/AuthProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
}

async function updateOrganization() {
const currentOrganization = await UniversimeApi.User.organization();
const usedOrganization = currentOrganization.body?.organization ?? null;
const currentOrganization = profile
? (await UniversimeApi.User.organization()).body?.organization
: null;

Check warning on line 75 in src/contexts/Auth/AuthProvider.tsx

View check run for this annotation

Codecov / codecov/patch

src/contexts/Auth/AuthProvider.tsx#L74-L75

Added lines #L74 - L75 were not covered by tests

const usedOrganization = currentOrganization ?? null;

setOrganization(usedOrganization);
return usedOrganization;
Expand Down

0 comments on commit 28b9f68

Please sign in to comment.