My SMM panel
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

78 lignes
1.7 KiB

  1. <template>
  2. <div class="support-section" id="main">
  3. <h2>Support</h2>
  4. <loading v-if="loading"></loading>
  5. <div v-if="!loading && !complete" id="support-form">
  6. <label for="">Topic</label>
  7. <select id="support-topic" name="" v-model="topic">
  8. <option value="order">Order</option>
  9. <option value="service">Service</option>
  10. <option value="credits">Credits</option>
  11. <option value="payment">Payment</option>
  12. <option value="other">Other</option>
  13. </select>
  14. <label for="">Details</label>
  15. <textarea id="" name="" cols="30" rows="10" v-model="message"></textarea>
  16. <span class="note-grey">Include any relevant information like the order number,
  17. service name, etc</span>
  18. <button @click="send">Submit</button>
  19. <p class="error-message">{{errorMessage}}</p>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import Loading from '../icons/loading.vue'
  25. function send() {
  26. this.errorMessage = ''
  27. if (!this.topic || !this.message) {
  28. this.errorMessage = 'Topic and details cannot be blank.'
  29. return
  30. }
  31. this.loading = true
  32. fetch("/panel/support", {
  33. method: 'POST',
  34. headers: {'Content-Type': 'application/json',
  35. 'Accept': 'application/json',
  36. 'X-XSRF-TOKEN': this.token},
  37. body: JSON.stringify({'topic': this.topic, 'message': this.message})}).
  38. then(response => {
  39. if (response.ok) {
  40. this.complete = true
  41. } else {
  42. this.complete = false
  43. this.error = true
  44. this.errorMessage = `${response.status}:
  45. ${response.statusText}`
  46. }
  47. this.loading = false
  48. })
  49. }
  50. export default {
  51. components: {Loading},
  52. props: ['user', 'token'],
  53. data() {
  54. return {loading: false, complete: false, error: false, errorMessage:
  55. '', topic: null, message: ''}
  56. },
  57. methods: {send}
  58. }
  59. </script>