Tue Nov 14 2017
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
<template>

  <v-container class="container about">
          
      <header>
        <h3>Shipping Addresses</h3>
        <p>
          Create addresses for a quicker checkout.<br>
          You'll be able to select your addresses from a list
          on the checkout process.
        </p>        
        <p>
          
        </p>
              
      </header> 
      

       <div v-if="isFetching">
         <Loading />
       </div>
       <div v-else>
         <div v-if='$store.state.user.addresses.length'>
           
         </div>
         <div v-else style="text-align: center" class="nope">
          You have no addresses saved.
         </div>
       </div>

      <div style="text-align:center">
        <v-card-text style="margin: 0 auto">
          <v-btn primary>add new address</v-btn>
        </v-card-text>    
      </div>
        

        
      
        

  </v-container>
</template>


<script>
import axios from 'axios'
import Loading from '~/components/Loading'
export default {
  components: {
    Loading
  },
  data()
  {
    return {
      isFetching: true,
      states: [
        "AL", "AK", "AS", "AZ", "AR", "CA", "CO", "CT", 
        "DE", "DC", "FM", "FL", "GA", "GU", "HI", "ID", 
        "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MH", 
        "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", 
        "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "MP", 
        "OH", "OK", "OR", "PW", "PA", "PR", "RI", "SC", 
        "SD", "TN", "TX", "UT", "VT", "VI", "VA", "WA", 
        "WV", "WI", "WY"
      ],
    }   
  },

  methods: {

  },

  async mounted () 
  {
    var req = await axios.get('/api/user/addresses')
    console.log(req)

    if (!req.data.result == 'success')
    {
      console.log('Sorry. We had trouble getting your addresses')
    }
    else
    {
      if (req.data.payload.length)
      {
        console.log('add: ', req.data.payload)
      }
      else
      {
        console.log('no add :( : ', req.data.payload)
      }
    }
    this.isFetching = false
  }
}
</script>

<style lang='stylus' scoped>
  @import '~assets/css/variables';
  
  .nope
    font-size 2em
    color #555
  p
    font-size 1.13em
    font-weight 100
    color #444
  .card
    width 100%
    margin-bottom 1em

  
</style>