Skip to content

Commit ab8db7b

Browse files
committed
fix: separate backend and frontend
1 parent 47622d4 commit ab8db7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2237
-3254
lines changed

README.md

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,45 @@ $ npm install
165165

166166
```
167167

168+
## Usage
169+
170+
### Test
171+
``` bash
172+
# test
173+
$ php vendor/bin/phpunit
174+
```
175+
176+
### If you need separate backend and frontend
177+
178+
``` bash
179+
# back to laravel directory
180+
$ cd ../laravel
181+
182+
# start local server
183+
$ php artisan serve
184+
185+
$ cd ../coreui
186+
187+
$ npm run serve
188+
```
189+
Open your browser with address: [localhost:8080](localhost:8080)
190+
191+
If you need change backend adress go to file /coreui/src/main.js
192+
And change line:
193+
```js
194+
Vue.prototype.$apiAdress = 'http://127.0.0.1:8000'
195+
```
196+
197+
### If you don't need separate backend and frontend
198+
199+
Go to file /laravel/routes/web.php
200+
And uncomment this lines:
201+
```php
202+
Route::get('/{any}', function () {
203+
return view('coreui.homepage');
204+
})->where('any', '.*');
205+
```
206+
168207
``` bash
169208
# back to laravel directory
170209
$ cd ../laravel
@@ -174,19 +213,14 @@ $ npm run dev
174213

175214
# and repeat generate mixing
176215
$ npm run dev
177-
```
178-
179-
## Usage
180216

181-
``` bash
182217
# start local server
183218
$ php artisan serve
184-
185-
# test
186-
$ php vendor/bin/phpunit
187219
```
220+
Open your browser with address: [localhost:8000](localhost:8000)
221+
222+
### When you have project open in browser
188223

189-
Open your browser with address: [localhost:8000](localhost:8000)
190224
Click "Login" on sidebar menu and log in with credentials:
191225

192226
* E-mail: _[email protected]_

coreui/package-lock.json

Lines changed: 1906 additions & 3137 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coreui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"core-js": "~3.6.4",
5353
"eslint": "~6.8.0",
5454
"eslint-plugin-vue": "~6.2.1",
55-
"node-sass": "~4.13.1",
55+
"node-sass": "~4.14.1",
5656
"npm-run-all": "~4.1.5",
5757
"sass-loader": "~8.0.2",
5858
"vue-template-compiler": "~2.6.11"

coreui/src/containers/Menu.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ export default {
113113
},
114114
mounted () {
115115
let self = this;
116-
axios.get( '/api/menu?token=' + localStorage.getItem("api_token") + '&menu=' + 'top_menu')
116+
console.log(this.$apiAdress)
117+
axios.get( this.$apiAdress + '/api/menu?token=' + localStorage.getItem("api_token") + '&menu=' + 'top_menu' )
117118
.then(function (response) {
118119
self.nav = self.rebuildData(response.data);
119120
}).catch(function (error) {

coreui/src/containers/TheHeaderDropdownAccnt.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default {
7777
methods:{
7878
logout(){
7979
let self = this;
80-
axios.post('/api/logout?token=' + localStorage.getItem("api_token"),{})
80+
axios.post(this.$apiAdress + '/api/logout?token=' + localStorage.getItem("api_token"),{})
8181
.then(function (response) {
8282
localStorage.setItem('roles', '');
8383
self.$router.push({ path: '/login' });

coreui/src/containers/TheSidebar.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ export default {
122122
this.show = sidebarClosed ? true : 'responsive'
123123
})
124124
let self = this;
125-
axios.get( '/api/menu?token=' + localStorage.getItem("api_token") )
125+
126+
console.log(this.$apiAdress);
127+
128+
axios.get( this.$apiAdress + '/api/menu?token=' + localStorage.getItem("api_token") )
126129
.then(function (response) {
127130
self.nav = self.rebuildData(response.data);
128131
}).catch(function (error) {

coreui/src/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import CoreuiVue from '@coreui/vue'
66
import { iconsSet as icons } from './assets/icons/icons.js'
77
import store from './store'
88

9+
Vue.prototype.$apiAdress = 'http://127.0.0.1:8000'
910
Vue.config.performance = true
1011
Vue.use(CoreuiVue)
1112

coreui/src/store.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const mutations = {
2121
}
2222
}
2323

24+
2425
export default new Vuex.Store({
2526
state,
2627
mutations

coreui/src/views/bread/Bread.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default {
5656
},
5757
mounted: function(){
5858
let self = this;
59-
axios.get( '/api/bread/' + self.$route.params.id + '?token=' + localStorage.getItem("api_token"))
59+
axios.get( this.$apiAdress + '/api/bread/' + self.$route.params.id + '?token=' + localStorage.getItem("api_token"))
6060
.then(function (response) {
6161
self.form = response.data.form
6262
self.formFields = response.data.formFields

coreui/src/views/bread/Breads.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default {
107107
},
108108
getBreads (){
109109
let self = this;
110-
axios.get( '/api/bread?token=' + localStorage.getItem("api_token") )
110+
axios.get( this.$apiAdress + '/api/bread?token=' + localStorage.getItem("api_token") )
111111
.then(function (response) {
112112
self.items = response.data;
113113
}).catch(function (error) {

0 commit comments

Comments
 (0)