File tree Expand file tree Collapse file tree 3 files changed +8
-14
lines changed Expand file tree Collapse file tree 3 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,7 @@ const AddUser = (props) => {
35
35
36
36
const getTeamList = async ( ) => {
37
37
setFormdata ( ( prev ) => ( { ...prev , password : generatePassword ( 12 ) } ) ) ;
38
- const extUser = JSON . parse ( localStorage . getItem ( "Extand_Class" ) ) ?. [ 0 ] ;
39
- const team = new Parse . Query ( "contracts_Teams" ) ;
40
- team . equalTo ( "OrganizationId" , {
41
- __type : "Pointer" ,
42
- className : "contracts_Organizations" ,
43
- objectId : extUser . OrganizationId . objectId
44
- } ) ;
45
- team . notEqualTo ( "IsActive" , false ) ;
46
- const teamRes = await team . find ( ) ;
38
+ const teamRes = await Parse . Cloud . run ( "getteams" ) ;
47
39
if ( teamRes . length > 0 ) {
48
40
const _teamRes = JSON . parse ( JSON . stringify ( teamRes ) ) ;
49
41
setTeamList ( _teamRes ) ;
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const HomeLayout = () => {
40
40
try {
41
41
// Use the session token to validate the user
42
42
const userQuery = new Parse . Query ( Parse . User ) ;
43
- const user = await userQuery . get ( Parse . User . current ( ) . id , {
43
+ const user = await userQuery . get ( Parse ? .User ? .current ( ) ? .id , {
44
44
sessionToken : localStorage . getItem ( "accesstoken" )
45
45
} ) ;
46
46
if ( user ) {
@@ -246,7 +246,7 @@ const HomeLayout = () => {
246
246
247
247
const handleLoginBtn = ( ) => {
248
248
try {
249
- Parse . User . logOut ( ) ;
249
+ Parse ? .User ? .logOut ( ) ;
250
250
} catch ( err ) {
251
251
console . log ( "err " , err ) ;
252
252
} finally {
Original file line number Diff line number Diff line change @@ -7,24 +7,26 @@ const ValidateRoute = () => {
7
7
try {
8
8
// Use the session token to validate the user
9
9
const userQuery = new Parse . Query ( Parse . User ) ;
10
- const user = await userQuery . get ( Parse . User . current ( ) . id , {
10
+ const user = await userQuery . get ( Parse ? .User ? .current ( ) ? .id , {
11
11
sessionToken : localStorage . getItem ( "accesstoken" )
12
12
} ) ;
13
13
if ( ! user ) {
14
14
handlelogout ( ) ;
15
15
}
16
16
} catch ( error ) {
17
+ console . log ( "err in validate route" , error ) ;
17
18
handlelogout ( ) ;
18
19
}
19
20
} ) ( ) ;
20
21
} , [ ] ) ;
21
22
const handlelogout = async ( ) => {
22
23
try {
23
- Parse . User . logOut ( ) ;
24
+ // if (Parse?.User?.current()) {
25
+ // Parse?.User?.logOut();
26
+ // }
24
27
localStorage . removeItem ( "accesstoken" ) ;
25
28
} catch ( err ) {
26
29
console . log ( "err " , err ) ;
27
- } finally {
28
30
localStorage . removeItem ( "accesstoken" ) ;
29
31
}
30
32
} ;
You can’t perform that action at this time.
0 commit comments