configure api
This commit is contained in:
parent
20cd5269aa
commit
f6dc1508dd
@ -4,6 +4,4 @@ const prodEnv = require('./prod.env')
|
||||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"',
|
||||
ROOT_API:'"http://localhost:5000"',
|
||||
|
||||
})
|
||||
|
@ -9,7 +9,7 @@ module.exports = {
|
||||
|
||||
// Paths
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
assetsPublicPath: '',
|
||||
|
||||
// Various Dev Server settings
|
||||
host: 'localhost', // can be overwritten by process.env.HOST
|
||||
@ -44,7 +44,7 @@ module.exports = {
|
||||
|
||||
build: {
|
||||
// Template for index.html
|
||||
index: path.resolve(__dirname, '../../backend/dist/index.html'),
|
||||
index: path.resolve(__dirname, '../dist/index.html'),
|
||||
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||
|
@ -1,5 +1,5 @@
|
||||
'use strict'
|
||||
module.exports = {
|
||||
NODE_ENV: '"production"',
|
||||
ROOT_API:'"/"'
|
||||
}
|
||||
ROOT_API:'"https://outlook.office.com/webhook/d607186d-098c-4d35-b188-440315e30b33@1d593042-a69d-49e0-8d1c-0daf8ac1717b/IncomingWebhook/b84597cf0ff2443a997d3bea0aad92bb/84d01e58-379e-4aff-862f-d308fc799011"'
|
||||
}
|
@ -1,17 +1,25 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const API_PATH = `${process.env.ROOT_API}/api/v1`;
|
||||
export function fetchchaine(num) {
|
||||
return axios.get(`${API_PATH}/chaine/${num}`);
|
||||
}
|
||||
export function fetchemission(num) {
|
||||
return axios.get(`${API_PATH}/chaine/${num}/emission`);
|
||||
}
|
||||
export function putparsechaine(jwt) {
|
||||
return axios.put(`${API_PATH}/chaine/`, '', { headers: { Authorization: `Bearer: ${jwt}` } });
|
||||
}
|
||||
export function authenticate(userData) {
|
||||
return axios.post(`${API_PATH}/login/`, userData);
|
||||
const API_PATH = `${process.env.ROOT_API}`;
|
||||
|
||||
export async function PostMood(MoodData) {
|
||||
const response = await fetch(API_PATH, {
|
||||
method: 'POST', // *GET, POST, PUT, DELETE, etc.
|
||||
mode: 'no-cors', // no-cors, *cors, same-origin
|
||||
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
// 'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
redirect: 'follow', // manual, *follow, error
|
||||
referrerPolicy: 'no-referrer', // no-referrer, *client
|
||||
body: JSON.stringify(MoodData) // body data type must match "Content-Type" header
|
||||
});
|
||||
return await response
|
||||
|
||||
|
||||
// return axios.post(`${API_PATH}`, JSON.stringify(MoodData));
|
||||
|
||||
}
|
||||
// export function register(userData) {
|
||||
// return axios.post(`${API_URL}/register/`, userData);
|
||||
|
@ -11,16 +11,16 @@
|
||||
<div class="field is-grouped-centered">
|
||||
<div class="control">
|
||||
<label class="label">Humeur</label>
|
||||
<b-slider rounded title="humeur" v-model="humeur" id="humeur" :step="1" :min="0" :max="5" ></b-slider>
|
||||
<b-slider rounded title="humeur" v-model="humeur" id="humeur" :step="1" :min="0" :max="3" ></b-slider>
|
||||
</div>
|
||||
<div class="control">
|
||||
<label class="label">stress</label>
|
||||
<b-slider rounded title="stress" v-model="stress" id="stress" :step="1" :min="0" :max="5"></b-slider>
|
||||
<b-slider rounded title="stress" v-model="stress" id="stress" :step="1" :min="0" :max="3"></b-slider>
|
||||
|
||||
</div>
|
||||
<div class="control">
|
||||
<label class="label">fatigue</label>
|
||||
<b-slider rounded title="fatigue" v-model="fatigue" id="fatigue" :step="1" :min="0" :max="5" ></b-slider>
|
||||
<b-slider rounded title="fatigue" v-model="fatigue" id="fatigue" :step="1" :min="0" :max="3" ></b-slider>
|
||||
|
||||
</div>
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
</div>
|
||||
<div class="field is-grouped is-grouped-centered">
|
||||
<div class="control">
|
||||
<button class="button is-success" v-on:click="">valider</button>
|
||||
<button class="button is-success" v-on:click="validate()">valider</button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<button class="button is-success" v-on:click="showModalname=true">modifier votre Nom</button>
|
||||
@ -46,11 +46,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { putparsechaine } from '../api';
|
||||
import { PostMood } from '../api';
|
||||
import modalname from './modalname'
|
||||
import modal from './modal'
|
||||
import { EventBus } from '../utils';
|
||||
|
||||
const HashSmile=["https://image.noelshack.com/fichiers/2020/14/1/1585595805-battery0.png","https://image.noelshack.com/fichiers/2020/14/1/1585595805-battery1.png","https://image.noelshack.com/fichiers/2020/14/1/1585595805-battery2.png","https://image.noelshack.com/fichiers/2020/14/1/1585595805-battery3.png"]
|
||||
|
||||
export default {
|
||||
name: 'Teammood',
|
||||
components: {
|
||||
@ -68,11 +70,48 @@ export default {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
validate() {
|
||||
|
||||
let cardJson={
|
||||
"title": this.$store.getters.name+ "'s mood",
|
||||
"sections": [
|
||||
{
|
||||
"activityTitle": "stress",
|
||||
"activityImage": HashSmile[this.stress],
|
||||
},
|
||||
{
|
||||
"activityTitle": "humeur",
|
||||
"activityImage": HashSmile[this.humeur],
|
||||
},
|
||||
{
|
||||
"activityTitle": "fatigue",
|
||||
"activityImage": HashSmile[this.fatigue],
|
||||
},
|
||||
],
|
||||
"text": " "
|
||||
}
|
||||
console.log(cardJson)
|
||||
return PostMood(cardJson)
|
||||
.then((res) => {
|
||||
console.log(res.status)
|
||||
if (res.status == '0') {
|
||||
this.modalmessage="votre humeur du jour a bien été prise en compte";
|
||||
this.showModal=true;
|
||||
} else {
|
||||
this.modalmessage="une erreur est survenu lors de l'envoie du formulaire merci de réessayer";
|
||||
this.showModal=true;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Network erreur');
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
console.log(this)
|
||||
|
||||
if(!this.$store.getters.name){
|
||||
this.showModalname=true;
|
||||
|
Loading…
Reference in New Issue
Block a user