Skip to content

Commit

Permalink
Fix getGraphqlError typings
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyAppeldoorn committed Aug 11, 2023
1 parent f7ad3de commit 51a09e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/modules/login/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { Button, Form, Message, Segment } from "semantic-ui-react";
import { Link, withRouter } from "react-router-dom";
import { History } from "history";
import { Mutation } from "@apollo/client/react/components";
import { gql } from "@apollo/client";
import { ApolloError, gql } from "@apollo/client";

import { GraphQLError } from "graphql";
import {
PATH_CHOOSE_TEAM,
PATH_FORGOT_PASSWORD,
Expand Down Expand Up @@ -44,7 +43,7 @@ export interface LoginResult {
id: string;
};
};
errors: GraphQLError[];
errors: ApolloError[];
};
}

Expand Down Expand Up @@ -93,7 +92,7 @@ class LoginPage extends Component<Props, State> {

this.props.history.push(PATH_CHOOSE_TEAM);
} else {
this.setState({ error: getGraphqlError(data.signInUser.errors) });
this.setState({ error: "Something went wrong." });
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/modules/manage-team/sections/kudometer/goals/EditGoal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Mutation } from "@apollo/client/react/components";
import { toast } from "react-toastify";
import { Button, Form, Message } from "semantic-ui-react";
import React, { ChangeEvent } from "react";
import { GraphQLError } from "graphql";

import {
CREATE_GOAL,
CreateGoalParameters,
Expand All @@ -12,6 +12,7 @@ import {
import settings from "../../../../../config/settings";
import { getGraphqlError } from "../../../../../support";
import { Storage } from "../../../../../support/storage";
import { ApolloError } from "@apollo/client";

export interface EditGoalProps {
kudometerId: string;
Expand Down Expand Up @@ -77,7 +78,7 @@ export class EditGoal extends React.Component<EditGoalProps, State> {
}).catch(this.handleError);
}

handleError(error: GraphQLError) {
handleError(error: ApolloError) {
const displayError = getGraphqlError(error);

this.setState({
Expand All @@ -98,7 +99,7 @@ export class EditGoal extends React.Component<EditGoalProps, State> {
toast.info(
this.state.editing
? "Goal updated successfully!"
: "Goal created successfully!"
: "Goal created successfully!",
);
this.setState({
goalName: "",
Expand Down

0 comments on commit 51a09e5

Please sign in to comment.