Support rest and implement SignIn and SignUp Rest + Mutations

This commit is contained in:
Chi Vinh Le
2018-08-10 19:07:41 +02:00
parent 7cb5ab37a7
commit 1dec622e64
12 changed files with 95 additions and 14 deletions
+6 -2
View File
@@ -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,
});
+5 -1
View File
@@ -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,
});