|
@@ -75,33 +75,38 @@ export default {
|
75
|
75
|
commit("onClearFilter", filter);
|
76
|
76
|
},
|
77
|
77
|
searchProperties({ commit }, item) {
|
78
|
|
- if (item.keyword === "") {
|
79
|
|
- item.keyword = "All";
|
80
|
|
- }
|
81
|
|
- if (log.isLoggedIn()) {
|
82
|
|
- item.userName = log.getUser().username;
|
83
|
|
- } else if (item.userName === "") {
|
84
|
|
- item.userName = "Unknown";
|
85
|
|
- }
|
86
|
|
- if (item.suburb === "") {
|
87
|
|
- item.suburb = "All";
|
88
|
|
- }
|
89
|
|
- if (item.city === "") {
|
90
|
|
- item.city = "All";
|
91
|
|
- }
|
92
|
|
- if (item.province === "") {
|
93
|
|
- item.province = "All";
|
94
|
|
- }
|
95
|
|
- console.log(
|
96
|
|
- `/api/Property/Search/${item.userName}/${item.keyword}/${item.salesType}/${item.propertyUsageType}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}/${item.minPrice}/${item.maxPrice}/${item.availableFrom}/${item.propertyId}`
|
97
|
|
- );
|
98
|
|
-
|
99
|
|
- axios
|
100
|
|
- .get(
|
|
78
|
+ return new Promise((resolve, reject) => {
|
|
79
|
+ if (item.keyword === "") {
|
|
80
|
+ item.keyword = "All";
|
|
81
|
+ }
|
|
82
|
+ if (log.isLoggedIn()) {
|
|
83
|
+ item.userName = log.getUser().username;
|
|
84
|
+ } else if (item.userName === "") {
|
|
85
|
+ item.userName = "Unknown";
|
|
86
|
+ }
|
|
87
|
+ if (item.suburb === "") {
|
|
88
|
+ item.suburb = "All";
|
|
89
|
+ }
|
|
90
|
+ if (item.city === "") {
|
|
91
|
+ item.city = "All";
|
|
92
|
+ }
|
|
93
|
+ if (item.province === "") {
|
|
94
|
+ item.province = "All";
|
|
95
|
+ }
|
|
96
|
+ console.log(
|
101
|
97
|
`/api/Property/Search/${item.userName}/${item.keyword}/${item.salesType}/${item.propertyUsageType}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}/${item.minPrice}/${item.maxPrice}/${item.availableFrom}/${item.propertyId}`
|
102
|
|
- )
|
103
|
|
- .then(result => commit("updateSearch", result.data))
|
104
|
|
- .catch(console.error);
|
|
98
|
+ );
|
|
99
|
+
|
|
100
|
+ axios
|
|
101
|
+ .get(
|
|
102
|
+ `/api/Property/Search/${item.userName}/${item.keyword}/${item.salesType}/${item.propertyUsageType}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}/${item.minPrice}/${item.maxPrice}/${item.availableFrom}/${item.propertyId}`
|
|
103
|
+ )
|
|
104
|
+ .then(result => {
|
|
105
|
+ commit("updateSearch", result.data);
|
|
106
|
+ resolve();
|
|
107
|
+ })
|
|
108
|
+ .catch(errro => reject(new Error(error.message)));
|
|
109
|
+ });
|
105
|
110
|
},
|
106
|
111
|
searchLatestProperties({ commit }) {
|
107
|
112
|
axios
|