mirror of
https://github.com/wassname/talk.git
synced 2026-09-12 13:01:11 +08:00
[next] Admin auth + design (#2056)
* feat: extract jwt information * feat: login status dependent auto redirect * feat: Sign Out button * feat: add a 404 page * feat: improve loading state and use auth token info * feat: redirect to previous destination * feat: implement new design * fix: change asset to story * feat: add translations * feat: more compact design * test: add unit tests * chore: refactor NavigationLink * test: add integration tests * chore: refactor replaceHistoryLocation * fix: typo * fix: property name typo
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { Environment } from "relay-runtime";
|
||||
|
||||
import { TalkContext } from "talk-framework/lib/bootstrap";
|
||||
import { createMutationContainer } from "talk-framework/lib/relay";
|
||||
import { commit as setAuthToken } from "talk-framework/mutations/SetAuthTokenMutation";
|
||||
import { signIn, SignInInput } from "talk-framework/rest";
|
||||
|
||||
export type SignInMutation = (input: SignInInput) => Promise<void>;
|
||||
|
||||
export async function commit(
|
||||
environment: Environment,
|
||||
input: SignInInput,
|
||||
context: TalkContext
|
||||
) {
|
||||
const result = await signIn(context.rest, input);
|
||||
setAuthToken(environment, { authToken: result.token }, context);
|
||||
}
|
||||
|
||||
export const withSignInMutation = createMutationContainer("signIn", commit);
|
||||
Reference in New Issue
Block a user