-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wire Register User Functionality (#897)
- Loading branch information
Showing
12 changed files
with
233 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Constants } from '../../components/common/Constants'; | ||
import { authHeader, handleError } from '../../components/common/AuthHeader'; | ||
|
||
export const authActions = { | ||
login, | ||
logout, | ||
registerBasicUser, | ||
}; | ||
|
||
function login(email, password) { | ||
console.log(email, password); | ||
// return { | ||
// type: Constants.LOGIN_SUCCESS, | ||
// payload: { token, refreshToken, user }, | ||
// }; | ||
|
||
return; | ||
} | ||
|
||
function logout(user) { | ||
console.log(user); | ||
return { | ||
type: Constants.LOGOUT_SUCCESS, | ||
}; | ||
} | ||
|
||
async function registerBasicUser(values) { | ||
const user = await registerBasicUserFunc(values); | ||
|
||
if (user) { | ||
alert('user registered, next PR we will log user in after succesful registration'); | ||
} | ||
// return { | ||
// type: Constants.REFRESH_TOKEN_SUCCESS, | ||
// payload: { token }, | ||
// }; | ||
return; | ||
} | ||
|
||
const registerBasicUserFunc = async (values) => { | ||
const url = '/api/auth/registerBasicUser'; | ||
|
||
values.registrationMethod = 'traditional'; | ||
|
||
const response = await fetch( | ||
url, | ||
{ | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(values), | ||
}, | ||
{ headers: authHeader() } | ||
); | ||
|
||
if (!response.ok) { | ||
handleError(response); | ||
return null; | ||
} | ||
|
||
const data = await response.json(); | ||
|
||
return data; | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.