fixed user not adding to localStorage
This commit is contained in:
@@ -9,13 +9,11 @@ export function signup(username: string, password: string)
|
|||||||
db.users = JSON.stringify({})
|
db.users = JSON.stringify({})
|
||||||
|
|
||||||
const users = JSON.parse(db.users)
|
const users = JSON.parse(db.users)
|
||||||
|
|
||||||
if (users[username])
|
if (users[username])
|
||||||
throw new Error('Username already exists')
|
throw new Error('User already exists')
|
||||||
|
|
||||||
users[username] = password
|
users[username] = password
|
||||||
db.users = JSON.stringify(users)
|
db.users = JSON.stringify(users)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function login(username: string, password: string)
|
export function login(username: string, password: string)
|
||||||
|
|||||||
Reference in New Issue
Block a user