Advertisement
Guest User

Untitled

a guest
Jun 28th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template>
  2.   <div id="memecontainer">
  3.     <h1>Hello</h1>
  4.  
  5.     <ul v-if="categories && categories.length">
  6.     <li v-for="(category, index) of categories">
  7.      <p><strong>{{category['name']}}</strong></p>
  8.        <ul v-if="memes && memes.length">
  9.        <li v-for="meme of memes[index]">
  10.          <p><strong>{{meme['name']}}</strong></p>
  11.       </li>
  12.       </ul>
  13.    </li>
  14.    </ul>
  15.  
  16.  <hr>
  17.  
  18.    <ul v-if="files && files.length">
  19.    <li v-for="file of files">
  20.      <p><strong>{{file}}</strong></p>
  21.    </li>
  22.  </ul>
  23. </div>
  24. </template>
  25.  
  26. <script>
  27. import Gitlab from 'gitlab'
  28.  
  29. export default {
  30.   components: {
  31.   },
  32.   data () {
  33.     return {
  34.       categories: [],
  35.       memes: [],
  36.       memeContent: [],
  37.       files: [],
  38.       errors: [],
  39.       ids: []
  40.     }
  41.   },
  42.   created () {
  43.     const api = new Gitlab({
  44.       url: 'https://meme.mememgmt.tk/',
  45.       token: 'xxxxxxxxxxxxxxxxxxxx'
  46.     })
  47.  
  48.     api.Projects.all()
  49.     .then((projects) => {
  50.       this.categories = projects
  51.       for (var i = 0; i < this.categories.length; i++) {
  52.         this.ids.push(this.categories[i].id)
  53.       }
  54.  
  55.       for (var j = 0; j < this.ids.length; j++) {
  56.         var id = this.ids[j]
  57.  
  58.         api.Branches.all(id)
  59.         .then((branches) => {
  60.           this.memes.push(branches)
  61.           console.log(branches)
  62.         })
  63.        .catch(e => {
  64.         this.errors.push(e)
  65.         })
  66.       }
  67.     })
  68.     .catch(e => {
  69.       this.errors.push(e)
  70.     })
  71.   }
  72. }
  73. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement