Skip to content

Commit

Permalink
feat(api): add status and error types to ConnectToken
Browse files Browse the repository at this point in the history
  • Loading branch information
merely04 committed Dec 27, 2023
1 parent 7e00d5a commit 88cff8a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/shared/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ export interface SignIn {
}

export interface ConnectToken {
status: number;
body: {
access_token: string;
refresh_token: string;
expires_in: number;
scope: string;
token_type: string;

validation_errors?: NonNullable<unknown>;
error_description?: string;
};
}

Expand All @@ -76,18 +80,6 @@ export const signInFx = createEffect<SignIn, ConnectToken>((form) => {
});
});

export interface SignUp extends SignIn {
displayName: string;
}

export const signUpFx = createEffect<SignUp, User>((form) => {
return requestFx({
method: 'POST',
path: '/api/users/register',
body: form,
});
});

export const logoutFx = createEffect<void, void>(() => {
localStorage.removeItem(LOCAL_STORAGE_ACCESS_TOKEN_KEY);
localStorage.removeItem(LOCAL_STORAGE_REFRESH_TOKEN_KEY);
Expand Down

0 comments on commit 88cff8a

Please sign in to comment.