My SMM panel
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

99 linhas
2.7 KiB

  1. import RegisterArea from './register-area/register-area.vue'
  2. import '../scss/main.scss'
  3. import { createApp } from 'vue'
  4. importAll(require.context('../images', false, /\.(png|jpe?g|svg)$/))
  5. let heroText = document.querySelectorAll(".landing-hero h2,.landing-hero p")
  6. let registerToggles = document.querySelectorAll(".register-btn, .register-area\
  7. .cancel-button, .services-cards button")
  8. let token = getCookie('XSRF-TOKEN')
  9. const app = createApp(RegisterArea).mount('#app')
  10. function importAll(r) {
  11. return r.keys().map(r)
  12. }
  13. function getCookie(name) {
  14. var re = new RegExp(name + "=([^;]+)")
  15. var value = re.exec(document.cookie)
  16. return (value != null) ? unescape(value[1]) : null
  17. }
  18. function getToken() {
  19. fetch("/sanctum/csrf-cookie", {
  20. method: 'GET'
  21. }).then( () => {
  22. token = getCookie('XSRF-TOKEN')
  23. })
  24. app.token = token
  25. }
  26. function login(event) {
  27. fetch("/login", {
  28. method: 'POST',
  29. headers: {'Content-Type': 'application/json',
  30. 'X-XSRF-TOKEN': token},
  31. body: JSON.stringify({"email":
  32. document.getElementById("login_email").value,
  33. "password": document.getElementById("login_password").value}),
  34. }).then(response => {
  35. console.log(response.json())
  36. console.log(response.ok)
  37. console.log(response.status)
  38. console.log(response.statusText)
  39. })
  40. event.preventDefault();
  41. }
  42. //Attempt to resend the verification link
  43. function resendLink(event) {
  44. console.log("clicked");
  45. event.preventDefault();
  46. }
  47. function toggleNav() {
  48. heroText.forEach(item => {
  49. item.classList.toggle("hidden")
  50. })
  51. document.querySelector("nav form.login").classList.toggle("active")
  52. this.classList.toggle("toggled")
  53. }
  54. if (!token) {getToken()}
  55. if (window.location.pathname == '/') {
  56. document.getElementById('nav_toggle').addEventListener('click', toggleNav)
  57. document.getElementById('login_form').addEventListener('submit', login)
  58. app.token = token
  59. // console.log(app.token)
  60. // console.log(app.$data.active)
  61. //Triggers for registration menu
  62. for (let i = 0; i < registerToggles.length; i++) {
  63. registerToggles[i].addEventListener("click", function() {
  64. document.querySelector(".register-area").classList.add("active")
  65. app.active = 'register'
  66. })
  67. }
  68. document.getElementById("forgot-password-btn").onclick = event => {
  69. document.querySelector(".register-area").classList.add("active")
  70. app.active = 'forgot'
  71. console.log(app.active)
  72. event.preventDefault()
  73. }
  74. //FAQ collapsibles
  75. let cols = document.getElementsByClassName("collapsible");
  76. for (let i = 0; i < cols.length; i++) {
  77. cols[i].addEventListener("click", function() {
  78. this.classList.toggle("active");
  79. });
  80. }
  81. } else if (window.location.pathname == '/verify-email') {
  82. document.getElementById('resend_verification').addEventListener("click", resendLink)
  83. }