Skip to content

Correctly recognise inline functions in Svelte templates #624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alexanderniebuhr opened this issue Jul 14, 2021 · 0 comments
Closed

Correctly recognise inline functions in Svelte templates #624

alexanderniebuhr opened this issue Jul 14, 2021 · 0 comments
Labels
bug Something isn't working sp:8

Comments

@alexanderniebuhr
Copy link
Contributor

Inline functions on:click={(e) => handle365Login(e)} should be ignored, they are placed inside the html tag arrows <|>

<script>
  import { useRouter } from "@svelteuse/router";
  import { onMount } from "svelte";
  import { msalInstance } from "../logic/auth.js";
  import { t } from "svelte-i18n";

  onMount(() => {
    console.log("onMount Login Page");
    async function init() {
      let redirectResponse = await msalInstance.handleRedirectPromise();
      if (redirectResponse !== null) {
        $useRouter.navigate("/");
        window.location.reload();
      }
    }
    init();
  });

  async function handle365Login(event) {
    console.log("LOGIN EVENT");

    msalInstance.loginRedirect().catch((e) => {
      console.error(e);
    });
  }
</script>

<f-button class="bg-light-300" on:click={(e) => handle365Login(e)}>
  {$t("page.login.ms365")}
</f-button>

<style>
</style>

image

@alexanderniebuhr alexanderniebuhr added the bug Something isn't working label Jul 14, 2021
@terales terales changed the title hard coded strings in svelte files should ignore inline functions Correctly recognise inline functions in Svelte templates Jul 14, 2021
@antfu antfu closed this as completed in 519f5b6 Jul 16, 2021
@antfu antfu added the sp:8 label Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sp:8
Development

No branches or pull requests

3 participants