Add password-based auth with JWT and remember-me
This commit is contained in:
1 parent
89deb869ab
commit
0042e7150c
10 files changed
+281
-37
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { api } from '@/lib/api';
|
||||
|
||||
export const authApi = {
|
||||
login: (password: string, remember: boolean) =>
|
||||
api
|
||||
.post<{ token: string; expiresIn: string }>('/auth/login', {
|
||||
password,
|
||||
remember,
|
||||
})
|
||||
.then((r) => r.data),
|
||||
|
||||
verify: (token: string) =>
|
||||
api
|
||||
.get<{ valid: boolean }>('/auth/verify', {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
.then((r) => r.data),
|
||||
};
|
||||
Reference in new issue
Block a user