Add rest endpoints

This commit is contained in:
Chi Vinh Le
2018-08-10 17:19:07 +02:00
parent bb39b4e8fa
commit 505bb48f8b
3 changed files with 29 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
export { default as signIn, SignInInput } from "./signIn";
export { default as signUp, SignUpInput } from "./signUp";
+13
View File
@@ -0,0 +1,13 @@
import { RestClient } from "../lib/rest";
export interface SignInInput {
username: string;
password: string;
}
export default function signIn(rest: RestClient, input: SignInInput) {
return rest.fetch("/tenant/auth/local", {
method: "POST",
body: input,
});
}
+14
View File
@@ -0,0 +1,14 @@
import { RestClient } from "../lib/rest";
export interface SignUpInput {
username: string;
password: string;
email: string;
}
export default function signUp(rest: RestClient, input: SignUpInput) {
return rest.fetch("/tenant/auth/local/signup", {
method: "POST",
body: input,
});
}