init portal
This commit is contained in:
12
frontend/portal/src/service/auth.js
Normal file
12
frontend/portal/src/service/auth.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { requestJson, setPortalAuthToken } from './apiClient';
|
||||
|
||||
export async function register({ username, password, confirmPassword, verifyCode }) {
|
||||
const data = await requestJson('/v1/auth/register', {
|
||||
method: 'POST',
|
||||
body: { username, password, confirmPassword, verifyCode }
|
||||
});
|
||||
const token = data?.token ?? '';
|
||||
if (token) setPortalAuthToken(token);
|
||||
return token;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user