Skip to content

Commit

Permalink
Update User.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Apr 24, 2024
1 parent c3ec6a5 commit c116c44
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/src/pages/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,16 @@ const User = () => {
const edit = loggedUser && user && (loggedUser.type === movininTypes.RecordType.Admin || loggedUser._id === user._id || (loggedUser.type === movininTypes.RecordType.Agency && loggedUser._id === user.agency))
const agency = user && user.type === movininTypes.RecordType.Agency

const _agencies: string[] = []
let _agencies: string[] = []
if (loggedUser && user) {
if ((agency && loggedUser._id === user._id)
|| (loggedUser.type === movininTypes.RecordType.Admin && user.type === movininTypes.RecordType.Agency)
) {
_agencies.push(user._id as string)
_agencies = [user._id as string]
} else if (loggedUser.type === movininTypes.RecordType.Agency && user.type === movininTypes.RecordType.User) {
_agencies.push(loggedUser._id as string)
_agencies = [loggedUser._id as string]
} else if (loggedUser.type === movininTypes.RecordType.Admin) {
_agencies.push(...agencies)
_agencies = agencies
}
}

Expand Down

0 comments on commit c116c44

Please sign in to comment.