[WIP] Добавил обертку для запросов

This commit is contained in:
megavrilinvv
2022-11-02 19:37:25 +03:00
parent ac282a624f
commit b12d740e24
3 changed files with 86 additions and 7 deletions

View File

@@ -22,6 +22,7 @@
</template>
<script>
import { fetchWrapper } from "../../shared/fetchWrapper.js";
import * as moment from "moment/moment";
import CalendarSchedule from "./components/CalendarSchedule.vue";
import CalendarSidebar from "./components/CalendarSidebar.vue";
@@ -68,14 +69,14 @@ export default {
this.membersData = res.results;
},
fetchEventsData() {
fetch("http://45.84.227.122:8080/registry/event/")
.then((res) => res.json())
fetchWrapper
.get("registry/event/")
.then((res) => this.saveEventsData(res));
fetch("http://45.84.227.122:8080/general/employee/")
.then((res) => res.json())
fetchWrapper
.get("general/employee/")
.then((res) => this.saveEmployeesData(res));
fetch("http://45.84.227.122:8080/general/person/")
.then((res) => res.json())
fetchWrapper
.get("general/person/")
.then((res) => this.saveMembersData(res));
},
changeWidth(value) {

View File

@@ -70,7 +70,7 @@ export default {
headers: { "Content-Type": "application/json" },
body: JSON.stringify(this.user),
};
fetch("http://45.84.227.122:8080/auth/jwt/create", requestOptions)
fetch("http://45.84.227.122:8080/auth/jwt/create/", requestOptions)
.then((result) => result.json())
.then((token) => {
localStorage.setItem("tokenAccess", token.access);