mirror of
https://github.com/wassname/talk.git
synced 2026-09-11 12:51:33 +08:00
Fix UserBox
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { Environment } from "relay-runtime";
|
||||
import { TalkContext } from "talk-framework/lib/bootstrap";
|
||||
import { createMutationContainer } from "talk-framework/lib/relay";
|
||||
import signOut from "../rest/signOut";
|
||||
import { commit as setAuthToken } from "./SetAuthTokenMutation";
|
||||
|
||||
export type SignOutMutation = () => Promise<void>;
|
||||
|
||||
export async function commit(environment: Environment, ctx: TalkContext) {
|
||||
await setAuthToken(environment, { authToken: "" }, ctx);
|
||||
await signOut(ctx.rest);
|
||||
}
|
||||
|
||||
export const withSignOutMutation = createMutationContainer("signOut", commit);
|
||||
@@ -3,3 +3,4 @@ export {
|
||||
SetAuthTokenMutation,
|
||||
SetAuthTokenInput,
|
||||
} from "./SetAuthTokenMutation";
|
||||
export { withSignOutMutation, SignOutMutation } from "./SignOutMutation";
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export { default as signIn, SignInInput } from "./signIn";
|
||||
export { default as signUp, SignUpInput } from "./signUp";
|
||||
export { default as signOff } from "./signOff";
|
||||
export { default as signOut } from "./signOut";
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { RestClient } from "../lib/rest";
|
||||
|
||||
export default function signOff(rest: RestClient) {
|
||||
return rest.fetch("/tenant/auth/local", {
|
||||
method: "DELETE",
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { RestClient } from "../lib/rest";
|
||||
|
||||
export default function signOut(rest: RestClient) {
|
||||
return rest.fetch("/tenant/auth", {
|
||||
method: "DELETE",
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user