(email, password)
| 51 | } |
| 52 | |
| 53 | export async function login(email, password) { |
| 54 | const username = email.split('@')[0]; |
| 55 | const response = await authRequest(LOGIN, {email, password}); |
| 56 | if (response.status !== 200) { |
| 57 | const content = await response.json(); |
| 58 | alert(`${content.error}, Error code: ${response.status}`) |
| 59 | return redirect("/login"); |
| 60 | } |
| 61 | const userInfo = { |
| 62 | user: username |
| 63 | } |
| 64 | await setUserInfo(userInfo); |
| 65 | return redirect("/"); |
| 66 | } |
| 67 | |
| 68 | export async function registerReset(email, password, token, status) { |
| 69 | const api = status === 'reset' ? RESET_PASSWORD : REGISTER; |
no test coverage detected