File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change 4646
4747 <div >
4848 <button type =" submit"
49- class =" group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" >
49+ :disabled =" loading"
50+ class =" group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
51+ :class =" {'cursor-not-allowed': loading, 'hover:bg-indigo-500': loading}"
52+ >
5053 <span class =" absolute left-0 inset-y-0 flex items-center pl-3" >
5154 <LockClosedIcon class =" h-5 w-5 text-indigo-500 group-hover:text-indigo-400" aria-hidden =" true" />
5255 </span >
56+ <svg
57+ v-if =" loading"
58+ class =" animate-spin -ml-1 mr-3 h-5 w-5 text-white"
59+ xmlns =" http://www.w3.org/2000/svg"
60+ fill =" none"
61+ viewBox =" 0 0 24 24"
62+ >
63+ <circle
64+ class =" opacity-25"
65+ cx =" 12"
66+ cy =" 12"
67+ r =" 10"
68+ stroke =" currentColor"
69+ stroke-width =" 4"
70+ ></circle >
71+ <path
72+ class =" opacity-75"
73+ fill =" currentColor"
74+ d =" M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
75+ ></path >
76+ </svg >
5377 Sign up
5478 </button >
5579 </div >
5680 </form >
5781</template >
5882
5983<script setup>
84+ import {ref } from ' vue'
6085import {LockClosedIcon } from ' @heroicons/vue/solid'
6186import store from " ../store" ;
6287import {useRouter } from " vue-router" ;
@@ -67,16 +92,22 @@ const user = {
6792 email: ' ' ,
6893 password: ' '
6994};
95+ const loading = ref (false );
7096
7197function register (ev ) {
7298 ev .preventDefault ();
99+ loading .value = true
73100 store
74101 .dispatch (' register' , user)
75102 .then (() => {
103+ loading .value = false
76104 router .push ({
77105 name: ' Dashboard'
78106 })
79107 })
108+ .catch (() => {
109+ loading .value = false ;
110+ })
80111}
81112
82113 </script >
You can’t perform that action at this time.
0 commit comments