parent
a9c3de6eb6
commit
91cdbb3031
@ -0,0 +1,24 @@
|
||||
import { REST_API } from "@/assets/const"
|
||||
import { DataObject, PagedDataObject } from "./dataObject"
|
||||
|
||||
export class Utilisateur extends DataObject{
|
||||
constructor(parsedJSON){
|
||||
super(parsedJSON)
|
||||
}
|
||||
static async get(id){
|
||||
const response = await fetch(`${REST_API}/utilisateur/${id}`)
|
||||
return new this(await response.json())
|
||||
}
|
||||
async register(){
|
||||
const response = await fetch(`${REST_API}/utilisateur`,{
|
||||
method:"POST",
|
||||
headers:{"Content-Type":"application/json"},
|
||||
body:JSON.stringify(this)
|
||||
})
|
||||
return new this(await response.json())
|
||||
}
|
||||
async login(){
|
||||
const response = await fetch(`${REST_API}/utilisateur/connexion`, {method:"POST" ,headers:{"Content-Type":"application/json"}, body:this})
|
||||
return new this(await response.json())
|
||||
}
|
||||
}
|
Loading…
Reference in new issue