Browse Source

Continue clearing TS errors

unoptim
GreatBearShark 2 years ago
parent
commit
e44544110c
  1. 2
      package.json
  2. 2
      src/components/modlog.tsx
  3. 6
      src/components/password_change.tsx
  4. 36
      src/components/private-message-form.tsx
  5. 5
      tsconfig.json

2
package.json

@ -6,7 +6,7 @@
"license": "AGPL-3.0-or-later",
"scripts": {
"api-test": "jest src/api_tests/api.spec.ts",
"build": "node generate_translations.js && NODE_ENV=production vite build --base=/static/",
"build": "node generate_translations.js && tsc --noEmit && NODE_ENV=production vite build --base=/static/",
"lint": "tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src",
"start": "node generate_translations.js && vite --port 4444 --open",
"storybook": "start-storybook -p 9009"

2
src/components/modlog.tsx

@ -456,7 +456,7 @@ export class Modlog extends Component<any, ModlogState> {
return;
} else if (res.op == UserOperation.GetModlog) {
let data = res.data as GetModlogResponse;
this.state.loading = false;
this.setState({ loading: false });
window.scrollTo(0, 0);
this.setCombined(data);
} else if (res.op == UserOperation.GetSite) {

6
src/components/password_change.tsx

@ -122,8 +122,7 @@ export class PasswordChange extends Component<any, State> {
handlePasswordChangeSubmit(i: PasswordChange, event: any) {
event.preventDefault();
i.state.loading = true;
i.setState(i.state);
this.setState({ loading: true });
WebSocketService.Instance.passwordChange(i.state.passwordChangeForm);
}
@ -133,8 +132,7 @@ export class PasswordChange extends Component<any, State> {
let res = wsJsonToRes(msg);
if (msg.error) {
toast(i18n.t(msg.error), 'danger');
this.state.loading = false;
this.setState(this.state);
this.setState({ loading: false });
return;
} else if (res.op == UserOperation.PasswordChange) {
let data = res.data as LoginResponse;

36
src/components/private-message-form.tsx

@ -229,8 +229,7 @@ export class PrivateMessageForm extends Component<
i.state.privateMessageForm
);
}
i.state.loading = true;
i.setState(i.state);
this.setState({ loading: true });
}
handleRecipientChange(i: PrivateMessageForm, event: any) {
@ -247,38 +246,39 @@ export class PrivateMessageForm extends Component<
i.props.onCancel();
}
handlePreviewToggle(i: PrivateMessageForm, event: any) {
handlePreviewToggle = (i: PrivateMessageForm, event: any) => {
event.preventDefault();
i.state.previewMode = !i.state.previewMode;
i.setState(i.state);
}
// i.state.previewMode = !i.state.previewMode;
this.setState({ previewMode: !this.state.previewMode });
};
handleShowDisclaimer(i: PrivateMessageForm) {
i.state.showDisclaimer = !i.state.showDisclaimer;
i.setState(i.state);
}
handleShowDisclaimer = () => {
this.setState({ showDisclaimer: !this.state.showDisclaimer });
};
parseMessage(msg: WebSocketJsonResponse) {
let res = wsJsonToRes(msg);
if (msg.error) {
toast(i18n.t(msg.error), 'danger');
this.state.loading = false;
this.setState(this.state);
this.setState({ loading: false });
return;
} else if (res.op == UserOperation.EditPrivateMessage) {
let data = res.data as PrivateMessageResponse;
this.state.loading = false;
this.setState({ loading: false });
this.props.onEdit(data.message);
} else if (res.op == UserOperation.GetUserDetails) {
let data = res.data as UserDetailsResponse;
this.state.recipient = data.user;
this.state.privateMessageForm.recipient_id = data.user.id;
this.setState(this.state);
this.setState({
recipient: data.user,
privateMessageForm: {
...this.state.privateMessageForm,
recipient_id: data.user.id,
},
});
} else if (res.op == UserOperation.CreatePrivateMessage) {
let data = res.data as PrivateMessageResponse;
this.state.loading = false;
this.setState({ loading: false });
this.props.onCreate(data.message);
this.setState(this.state);
}
}
}

5
tsconfig.json

@ -23,8 +23,5 @@
"include": [
"src", "public/assets"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
"exclude": ["node_modules", "**/*.spec.ts"]
}
Loading…
Cancel
Save