Skip to content

Instantly share code, notes, and snippets.

@dkovacevic15
Last active July 15, 2020 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkovacevic15/0cfd95e6c0cad4c5ec60828a85297cb2 to your computer and use it in GitHub Desktop.
Save dkovacevic15/0cfd95e6c0cad4c5ec60828a85297cb2 to your computer and use it in GitHub Desktop.
interface MisingEmail {
status: 400;
body: { error: "MISSING_EMAIL"}
}
interface MissingPassword {
status: 400;
body: { error: "MISSING_PASSWORD" }
}
interface InvalidPassword {
status: 401;
body: { error: "INVALID_PASSWORD" }
}
interface Success {
status: 200;
body: { token: string }
}
type LoginApiResponse = MissingEmail | MissingPassword | InvalidPassword | Success;
// Doesn't work, but illustrative of what I want
type AxiosApiResponse = Omit<LoginApiResponse, 'body'> & { data: typeof LoginApiResponse.body };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment