mirror of
https://github.com/wassname/talk.git
synced 2026-08-20 12:50:41 +08:00
Support rest and implement SignIn and SignUp Rest + Mutations
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
import { RestClient } from "../lib/rest";
|
||||
|
||||
export interface SignInInput {
|
||||
username: string;
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface SignInResponse {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export default function signIn(rest: RestClient, input: SignInInput) {
|
||||
return rest.fetch("/tenant/auth/local", {
|
||||
return rest.fetch<SignInResponse>("/tenant/auth/local", {
|
||||
method: "POST",
|
||||
body: input,
|
||||
});
|
||||
|
||||
@@ -6,8 +6,12 @@ export interface SignUpInput {
|
||||
email: string;
|
||||
}
|
||||
|
||||
export interface SignUpResponse {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export default function signUp(rest: RestClient, input: SignUpInput) {
|
||||
return rest.fetch("/tenant/auth/local/signup", {
|
||||
return rest.fetch<SignUpResponse>("/tenant/auth/local/signup", {
|
||||
method: "POST",
|
||||
body: input,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user